在我的布局中实现了一些按钮后,在应用程序部署期间logcat中会出现以下错误:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<TextView
android:id="@+id/Information_textView"
style="@android:style/TextAppearance.Large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/information"
android:textColor="@android:color/black" />
<TableLayout
android:id="@+id/Information_tableLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:layout_below="@id/Information_textView">
<TableRow
android:id="@+id/tableRow0"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/Information_btnMale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_male"
android:text="@string/male"
android:textColor="@android:color/white"
android:textSize="30sp"/>
</TableRow>
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/Information_btnFemale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@drawable/female"
android:text="@string/female"
android:textColor="@android:color/white"
android:textSize="30sp"/>
</TableRow>
</TableLayout>
</RelativeLayout>
</ScrollView>
public class FragmentInformation extends android.support.v4.app.Fragment {
public FragmentInformation() {
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.information, container, false);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
View v = getView();
assert v != null;
button0 = (Button) v.findViewById(R.id.Information_btnMale);
button0.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
HeaderDialog headerDialog = new HeaderDialog(getActivity());
headerDialog.setTitle(getResources().getString(R.string.male); headerDialog.setMessage(getResources().getString(R.string.male_information);
headerDialog.setNegativeButton("OK", null);
}
});
Button button1 = (Button) v.findViewById(R.id.Information_btnFemale);
button1.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
HeaderDialog headerDialog = new HeaderDialog(getActivity());
headerDialog.setTitle(getResources().getString(R.string.female);
headerDialog.setNegativeButton("OK", null);
}
});
super.onActivityCreated(savedInstanceState);
}
}
洛克卡特
06-27 18:44:58.214 7756-7756/com.companyname.informationapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.companyname.informationapp, PID: 7756
android.view.InflateException: Binary XML file line #413: Error inflating class Button
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.companyname.informationapp.FragmentInformation.onCreateView(FragmentInformation.java:30)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2192)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149)
at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)
at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1984)
at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:626)
at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:166)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1268)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:668)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:630)
at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:611)
也许,您可能已经从支持库23.2.0升级,之后进行了更改
由于内存使用和配置更新问题,它在23.3.0中被删除。在23.4.0中,添加了相同的功能,但需要手动启用
static {
AppCompatDelegate.setCompatVectorFromSourcesEnabled(true);
}
我不知道,为什么我会有这个问题。我添加了行来构建gradle,但它仍然不起作用。出什么事了?
我试图让我的布局工作,将实现支持设计库功能。然而,当我尝试运行该项目,我得到以下异常时,我的布局是加载。 二进制XML文件行#2:inflating类android.support.design.widget.错误 这是我的布局: 我尝试构建了一个简单的测试项目,该项目实现了CollapsingToolbarLayout,它没有任何问题,但一旦我尝试将其放入我的项目中,它就停止工作了。 我检查了n
错误跟踪: 致命异常:主进程:com.example.user.itekit,pid:23028 android.view.inflateException:二进制XML文件行#87:在android.view.layoutinflater.createViewFromTag(layoutinflater.java:764)在android.view.layoutinflater.rinflate
我的应用程序崩溃了 膨胀类Android.Support.Design.Widget.FloatingActionButton时出错 这是我的XML代码 这是我的卷轴 有人能说出我的错吗?
所以首先我在我的AndroidManifest中添加了FacebookActivity: 第二,我在我的片段中添加了登录按钮: 最后,这是我的以下代码: