导航抽屉的Andr​​oid API的具体布局属性抽屉、布局、属性、具体

2023-09-05 00:23:10 作者:孤病i

您好我创建了一个导航抽屉的ListView导航使用的ActionBar福尔摩斯 Android的支持库V4 的旧版本compatbility(我的应用程序的的minSdkVersion =8)中,我已经使用了一些属性的TextView中的ListView:

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"/>

这是示值误差为安卓?ATTR / activatedBackgroundIndicator 是API 11和安卓?ATTR / textAppearanceListItemSmall &安培; 安卓?ATTR /列表preferredItemHeightSmall 从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.

我勉力支撑安卓?ATTR / activatedBackgroundIndicator 通过动作条夏洛克的 ATTR / activatedBackgroundIndicator 替换它?但我没有发现任何等值的其他两个属性。有?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的尺寸(如列表preferredItemHeightSmall 等)。在一些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.