Android 如何在此xml文件中找到错误?
我在这个XML文件的某个地方遇到了一个错误,但是eclipse没有提供关于哪一行和lint没有显示错误的信息。所以 (a) 我究竟该如何发现错误呢 (b) 谁能告诉我出了什么事Android 如何在此xml文件中找到错误?,android,xml,Android,Xml,我在这个XML文件的某个地方遇到了一个错误,但是eclipse没有提供关于哪一行和lint没有显示错误的信息。所以 (a) 我究竟该如何发现错误呢 (b) 谁能告诉我出了什么事 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="?android:attr/dividerVertical"
android:dividerPadding="12dp"
android:orientation="horizontal"
android:baselineAligned="false"
android:showDividers="middle" >
<FrameLayout
android:id="@+id/actionbar_cancel"
style="?android:actionButtonStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" >
<TextView
style="?android:actionBarTabTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableLeft="@drawable/ic_action_accept"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:paddingRight="20dp"
android:text="@string/save" />
</FrameLayout>
<FrameLayout
android:id="@+id/actionbar_done"
style="?android:actionButtonStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" >
<TextView
style="?android:actionBarTabTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableLeft="@drawable/ic_action_cancel"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:paddingRight="20dp"
android:text="@string/cancel" />
</FrameLayout>
</LinearLayout>
检查logcat消息,它将显示错误的行号。您缺少xml符号
编辑:
其他一切看起来都很好。确保你的minApi是11。对于您正在使用的样式,您需要它。
还有一些方法可以优化布局。一条直线的布局就可以了。我认为
的风格不正确?如果它像?android:attr/actionBarTabTextStyle
?根据,这是有效的XML。你的意思是有些设置是错误的?“错误是什么?”:这就是我不明白的。Eclipse在文件管理器中显示“红色x”,但是没有其他东西可以指示哪里或哪里出了问题。我通过复制一个工作文件设法“解决”了这个问题,但我仍然想知道出了什么问题,这样我就不会再犯同样的错误,不管是什么错误。