我正在使用Android Recyclerview。在我的主要活动中,我有一个名为BlogViewHolder
的公共静态类,该类扩展了RecyclerView.ViewHolder。当我在onstart方法中将此BlogViewHolder
附加到FirebaseRecyclerAdapter时,它显示错误BlogViewHolder is not within its bound should extend androidx.recyclerview.widget.Recyclerview.ViewHolder
以下是我的代码。我在做什么错
@Override
protected void onStart() {
super.onStart();
FirebaseRecyclerAdapter<Blog,BlogViewHolder> // here error is giving
}
//this is BlogViewHolder
public static class BlogViewHolder extends RecyclerView.ViewHolder{
View mview;
public BlogViewHolder(View itemView) {
super(itemView);
itemView =mview;
}
public void setDrop(String drop){
TextView droplocation=(TextView) mview.findViewById(R.id.tvDrop);
droplocation.setText(drop);
}
}
这就是我的Build.gradle文件中的内容
implementation "com.android.support:support-v13:25.0.+"
implementation 'com.android.support:appcompat-v7:25.3.1'
implementation 'com.hbb20:ccp:1.7.2'
implementation 'com.android.support:design:25.0.0'
implementation 'com.google.android.gms:play-services:10.0.1'
implementation 'com.android.support:multidex:1.0.1'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.android.support:recyclerview-v7:25.1.1'
implementation 'com.android.support:cardview-v7:25.1.1'
implementation 'com.github.krtkush:LinearTimer:v2.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'net.hockeyapp.android:HockeySDK:4.0.0'
implementation 'com.android.volley:volley:1.0.0'
implementation 'com.google.firebase:firebase-messaging:9.6.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'me.zhanghai.android.materialratingbar:library:1.0.2'
implementation 'com.google.maps.android:android-maps-utils:0.4'
implementation 'com.iarcuschin:simpleratingbar:0.1.5'
testCompile 'junit:junit:4.12'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.github.florent37:camerafragment:1.0.7' // Custom camera
implementation 'com.google.firebase:firebase-database:9.6.0'
implementation 'com.firebaseui:firebase-ui-database:6.1.0'
答案 0 :(得分:0)
即使我也有同样的错误
scanf()
将此扩展到您的 extends android.support.v7.widget.RecyclerView.ViewHolder
类并尝试,这对我有用