我在我的项目中使用操作栏和导航抽屉。使用 appcompat v7 和 v4。
我已经添加了 appcompat v7 和资源。
以下是我的导航抽屉列表的文本视图,直接取自位于以下位置的 Android 示例应用程序:创建抽屉式导航 http://developer.android.com/training/implementing-navigation/nav-drawer.html
下面三行都导致我的应用程序失败,它构建得很好,但我强制关闭,我不知道如何解决问题。考虑到我添加了 appcompat 及其资源,我不明白为什么找不到这些属性。或者它们对应用程序兼容性或其他东西无效?
MinSDK 版本为 10,代码失败。 API 10 以上的代码可以正常工作。
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textColor="#fff"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:background="?android:attr/activatedBackgroundIndicator"
android:minHeight="?android:attr/listPreferredItemHeightSmall"/>
您可以使用兼容性库中定义的值:它指定除背景之外的所有值,我选择了 listChoiceBackgroundIndicator,尽管您也可以使用其他背景。
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textColor="#fff"
android:background="?attr/listChoiceBackgroundIndicator"
android:minHeight="?attr/listPreferredItemHeightSmall"/>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)