如何解决这个问题;二进制XML文件行#0:膨胀类android.support.v7.widget.CardView时出错;?
这肯定是问题的重复。但即使在互联网上爬行,我仍然找不到解决方案。我想使用如何解决这个问题;二进制XML文件行#0:膨胀类android.support.v7.widget.CardView时出错;?,android,listview,fragment,cardview,Android,Listview,Fragment,Cardview,这肯定是问题的重复。但即使在互联网上爬行,我仍然找不到解决方案。我想使用ArrayAdapter或someCustomAdapter在Cate_布局中设置类别(我已经尝试了这两种方法,但都没有成功:() 这是Logcat 致命异常:主 进程:tomestore.wixsite.com.tome,PID:14405 android.view.InflateException:二进制XML文件行#0:二进制XML文件行#0:膨胀类android.support.v7.widget.CardView时
ArrayAdapter
或someCustomAdapter
在Cate_布局中设置类别
(我已经尝试了这两种方法,但都没有成功:()
这是Logcat
致命异常:主
进程:tomestore.wixsite.com.tome,PID:14405
android.view.InflateException:二进制XML文件行#0:二进制XML文件行#0:膨胀类android.support.v7.widget.CardView时出错
原因:android.view.InflateException:二进制XML文件行#0:膨胀类android.support.v7.widget.CardView时出错
原因:java.lang.reflect.InvocationTargetException
我有一个碎片书碎片
public class BookFragment extends Fragment {
ListView listView;
String[] something ={"something", " nothing"};
public BookFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_book, container, false);
listView = view.findViewById(R.id.cateSlit);
listView.setAdapter(new ArrayAdapter<>(getActivity().getApplicationContext(),R.layout.cate_layout,R.id.catagory,something));
return view;
}
用这个
android:foreground="?android:attr/selectableItemBackground"
而不是这个
android:foreground="?attr/selectableItemBackground"
您是否添加了compile'com.android.support:design:25.3.1'
yupimplementation'com.android.support:design:26.1.0
在这里
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "tomestore.wixsite.com.tome"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-storage:11.0.4'
implementation 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.google.firebase:firebase-messaging:11.0.4'
implementation 'com.android.support:recyclerview-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
// RecyclerView
compile 'com.android.support:recyclerview-v7:26.1.0'
// CardView
compile 'com.android.support:cardview-v7:26.1.0'
}
apply plugin: 'com.google.gms.google-services'
android:foreground="?android:attr/selectableItemBackground"
android:foreground="?attr/selectableItemBackground"