Kai*_*dul 9 api layout android
您好我已经创建了一个带有ListView导航的导航抽屉使用ActionBar Sherlock和android support Library v4旧版本兼容性(我的应用程序的minSdkversion ="8"),其中我在ListView中使用了textview的一些属性:
<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"/>
Run Code Online (Sandbox Code Playgroud)
这被示出误差?android:attr/activatedBackgroundIndicator是从API 11和?android:attr/textAppearanceListItemSmall&?android:attr/listPreferredItemHeightSmall是从API 14.
我设法?android:attr/activatedBackgroundIndicator通过用actionBar Sherlock替换它来支持?attr/activatedBackgroundIndicator.但我没有发现其他两个属性的任何等价.有?attr/textAppearanceListItemSmall在动作条福尔摩斯,但它不能正常工作.
那么这些属性的等价性为2.1以上的所有API提供支持?
yaj*_*esh 31
要支持较低版本,请不要删除以下三个参数,
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:background="?android:attr/activatedBackgroundIndicator"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
Run Code Online (Sandbox Code Playgroud)
实际上,您可以使用等效的值/资源替换它们.
可以从https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/themes.xml获取等效值
现在,
一个) android:textAppearance="@android:style/TextAppearance.Medium"
b)
从https://github.com/habzy/Test0011_DialerPad/blob/master/res/drawable/list_item_activated_background.xml下载选择器
在上面的项目中浏览hdpi,mdpi等资源并获取名为list_activated_holo.9.png的文件
最后
android:background="@drawable/list_item_activated_background"
c)从获得的等效值,我们知道 listPreferredItemHeightSmall是48dip
android:minHeight="48dip"
我不确定你是否真的需要使用android尺寸(比如listPreferredItemHeightSmall等)。在某些android版本中,该尺寸可以是12,而在其他版本中可以是14。我建议你创建自己的尺寸,它将在你的整个应用程序中使用,并且当需要更改时,您可以轻松编辑它们。
| 归档时间: |
|
| 查看次数: |
11522 次 |
| 最近记录: |