gpt4 book ai didi

android: 标签导致错误

转载 作者:行者123 更新时间:2023-11-29 00:33:49 25 4
gpt4 key购买 nike

当我在我的另一个 xml 中包含导航条码 xml 时,它会生成以下错误:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my/com.my.Login}: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>

login.xml 是

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/tableStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<include
android:layout_height="wrap_content"
layout="@layout/navbar" />

</LinearLayout>

navbar.xml 是

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@style/tableRowStyle"
android:orientation="horizontal"
android:paddingRight="0dp" >

<Button
android:id="@+id/button2"
android:layout_width="52dp"
android:layout_height="48dp"
android:background="@drawable/home" />

<View
android:layout_width="1px"
android:layout_height="fill_parent"
android:background="#1f1f1f" />

<View
android:layout_width="1px"
android:layout_height="fill_parent"
android:background="#454545" />

<Button
android:id="@+id/button1"
android:layout_width="190dp"
android:layout_height="48dp"
android:layout_weight="0.35"
android:background="@drawable/stock" />

<View
android:layout_width="1px"
android:layout_height="fill_parent"
android:background="#1f1f1f" />

<View
android:layout_width="1px"
android:layout_height="fill_parent"
android:background="#454545" />

<Button
android:id="@+id/button2"
android:layout_width="52dp"
android:layout_height="48dp"
android:background="@drawable/home" />

</LinearLayout>

背后的问题是什么?

最佳答案

难道是

<include
android:layout_height="wrap_content"
layout="@layout/navbar" />

应该是

<include
android:layout_height="wrap_content"
android:layout="@layout/navbar" />

关于android:<include> 标签导致错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13796214/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com