无法解析符号“ RecycleView”

时间:2018-10-11 19:00:52

标签: java android

问题基本上是,当尝试在类中使用RecyclerView时,出现错误“无法解析符号“ RecycleView”

这是我的gradle代码

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class=" w-container">
        <div class="sliderTrack">
            <div class="mySlides grow" onclick="wSlider.focusSlide(this)">
                <div class="content">
                    <div class="displayLeft h1 word-amount-2">
                        <p>
                            <span>Unreal</span>
                        </p>
                        <p>
                            <span>Engine</span>
                        </p>
                        <button href="https://www.unrealengine.com" class="explore">
                            Explore</a>
                    </div>
                </div>
                <img class="growImg"
                    src="https://cdn2.unrealengine.com/Epic+Games+Node%2Fue-alt-1920x1080-e653a4a4dae65307fd2420076abe44bb71b22f06.jpg"
                    style="width: 100%">

                <div class="close-slide" onclick="wSlider.unfocusSlide(this)">X</div>

            </div>
            <div class="mySlides grow" onclick="wSlider.focusSlide(this)">
                <div class="content">
                    <div class="displayLeft h1 word-amount-1">
                        <p>
                            <span>Fortnite</span>
                        </p>
                        <button class="explore">
                            Explore</a>
                    </div>
                </div>
                <img class="growImg"
                    src="https://cdn2.unrealengine.com/Epic+Games+Node%2Ffn-1920x1080-05e434e24b3170bc6cc6003c102270ee4cde3a75.jpg"
                    style="width: 100%">
                <div class="close-slide" onclick="wSlider.unfocusSlide(this)">X</div>

            </div>
            <div class="mySlides grow" onclick="wSlider.focusSlide(this)">

                <div class="content" style="">
                    <div class="displayLeft h1 word-amount-2">
                        <p>
                            <span>Robo</span>
                        </p>
                        <p>
                            <span>Recall</span>
                        </p>
                        <button class="explore">
                            Explore</a>
                    </div>
                </div>
                <img class="growImg"
                    src="https://cdn2.unrealengine.com/Epic+Games+Node%2Frr-1920x1080-5a3f8bce26f45d078c2738cf5140ad18be39041c.jpg"
                    style="width: 100%">

                <div class="close-slide" onclick="wSlider.unfocusSlide(this)">X</div>
            </div>

        </div>
    </div>

    <div class="ctrl-buttons">
        <button class="w-button w-white w3-display-left"
            onclick="wSlider.sliderMove(-1)">&#10094;</button>
        <button class="w-button w-white w3-display-right"
            onclick="wSlider.sliderMove(1)">&#10095;</button>
    </div>

这是我的课程

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.android.support:recyclerview-v7:28.0.+'

1 个答案:

答案 0 :(得分:2)

ViewHolder不应扩展RecyclerView,但无论如何您都需要导入语句

您想要

import android.support.v7.widget.RecyclerView.ViewHolder;

public class YourViewHolder extends RecyclerView.ViewHolder {

注意:您已经拥有implementation 'com.android.support:recyclerview-v7:28.0.0',因此请删除recyclerview-v7:28.0.+'