[英]Navigation Drawer Using Appcompat v7 - Issues with ?android:attr Tag
我在我的项目中使用了操作栏和导航抽屉。 使用appcompat v7和v4。
我添加了appcompat v7 WITH资源。
以下是直接从创建导航抽屉中找到的android示例应用程序中获取的导航抽屉列表的textview
底部的三行都导致我的应用程序失败,它构建正常,但我得到一个力量关闭,我不知道如何解决问题。 我不明白为什么没有找到属性,考虑到我添加了appcompat及其资源。 或者他们无法使用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"/>
我有同样的问题。 据我所知,旧的apis还没有预定义textAppearanceListItemSmall,activatedBackgroundIndicator和listPreferredItemHeightSmall。 因此,如果您需要,您可以指定自己的值或删除此行并依靠您的运气。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.