项目有 4 个可绘制和布局文件夹(xh、h、m、l)。这是清单的一部分:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" />
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />
这是xhdpi的整个主要xml代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@layout/bg_repeat" >
<RelativeLayout
android:id="@+id/bg_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="@drawable/bg_header"
android:padding="0dip">
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/text_header" />
</RelativeLayout>
<ListView
android:id = "@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@null"
android:dividerHeight="2.5dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:cacheColorHint="@android:color/transparent"
android:listSelector="@android:color/transparent"
/>
</LinearLayout>
这是 xhdpi 的行 xml:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:foo="http://schemas.android.com/apk/res/test"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:paddingLeft="20dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/menu_selector">
<test.TextViewPlus
android:id="@+id/menutext"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#3D1E00"
android:textSize="@dimen/TitleNormalXH"
foo:customFont="Mj_Shablon.ttf"
android:gravity="right|center_vertical"/>
</LinearLayout>
</LinearLayout>
这是银河笔记模拟器设置: dpi:285 。安卓版本:google api level 10 (2.3.3)
这是输出:
第二个问题:put android:background="@drawable/menu_selector" for row 的布局和 listview 的布局有什么不同?