Navigation Drawer Android API 特定的布局属性 [英] Navigation Drawer Android API specific Layout Attribute
问题描述
您好,我使用 ActionBar Sherlock
和 android support Library v4
创建了一个带有 ListView 导航的导航抽屉,用于旧版本兼容性(我的应用程序的 minSdkversion="8"),其中我在 ListView 中为 textview 使用了一些属性:
Hello I have created a navigation drawer with ListView navigation using ActionBar Sherlock
and android support Library v4
for old version compatbility (my app's minSdkversion="8") in which I have used some attributes for textview in ListView:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="5dp"
android:textColor="#fff"
android:background="?android:attr/activatedBackgroundIndicator"
android:minHeight="?android:attr/listPreferredItemHeightSmall"/>
这显示错误,因为 ?android:attr/activatedBackgroundIndicator
来自 API 11 和 ?android:attr/textAppearanceListItemSmall
&?android:attr/listPreferredItemHeightSmall
来自 API 14.
This is showing error as ?android:attr/activatedBackgroundIndicator
is from API 11 and ?android:attr/textAppearanceListItemSmall
& ?android:attr/listPreferredItemHeightSmall
are from API 14.
我设法通过用 actionBar Sherlock 的 ?attr/activatedBackgroundIndicator
替换它来支持 ?android:attr/activatedBackgroundIndicator
.但我没有发现其他两个属性有任何等价性.actionBar Sherlock 中有 ?attr/textAppearanceListItemSmall
但它不能正常工作.
I managed to support ?android:attr/activatedBackgroundIndicator
by replacing it with actionBar Sherlock's ?attr/activatedBackgroundIndicator
. But I didn't find any equivalence for other two attributes. There is ?attr/textAppearanceListItemSmall
in actionBar Sherlock but it is not properly working.
那么这些属性在提供支持 2.1 以上的所有 API 方面的等效性是什么?
So what are the equivalence for these attributes to provide support all the API above 2.1 ?
推荐答案
我不确定您是否真的需要使用 android 尺寸(例如 listPreferredItemHeightSmall
等)在某些 android 版本中该尺寸可以是12 和其他 14. 我建议您创建自己的维度,它将在您的整个应用程序中使用,您可以在需要更改时轻松编辑它们.
I am not sure if you really need to use android dimensions (like listPreferredItemHeightSmall
etc.) In some android version can that dimension be 12 and in other 14. I suggest you to create your own dimension, which will be used in your whole app, and you can easily edit them when change is needed.
这篇关于Navigation Drawer Android API 特定的布局属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!