对于大多数.xml文件,我的设计中存在一些缺陷,其中一些屏幕上的尺寸通常较大,而较低的屏幕上的尺寸通常较大。我使用px(像素)。Android .xml设计
我知道这对我来说可能是一个糟糕的选择,因为新手机会以更高的像素比例结束。例如三星Galaxy Nexus将所有文本制作成小文本。
什么会是一个更合适的类型用于未来的电话来?
附加:
我已经使用了很长一段时间的线性布局,但现在,我需要一个滚动的长菜单我设计嵌套在滚动型,其滚动型嵌套的线性布局的RelativeLayout的。嵌套tableLayout以更好地控制视图会更好吗?
不想泛滥的问题屏幕因为它看起来丑陋。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/tab_tv_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/auto_Action"
android:background="#666666"
android:text="@string/options_dialog_menu_Action"
android:textSize="27px"
/>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/FirstOption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/manual_Action"
android:layout_below="@+id/tab_tv_one"
android:text="@string/options_dialog_menu_Auto_Action"
android:textSize="27px" />
<RadioButton
android:id="@+id/SecondOption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/tab_tv_two"
android:layout_below="@+id/auto_Action"
android:text="@string/options_dialog_menu_Manual_Action"
android:textSize="27px"
android:onClick="onClick"
android:clickable="true"
/>
<RadioButton
android:id="@+id/ThirdOption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/tab_tv_two"
android:layout_below="@+id/manual_Action"
android:textSize="27px"
android:onClick="onClick"
android:clickable="true"
/>
</RadioGroup>
<TextView
android:id="@+id/tab_tv_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/text_size"
android:layout_below="@+id/manual_Action"
android:background="#666666"
android:text="@string/options_dialog_menu_Layout_Options"
android:textSize="27px"
/>
<TextView
android:id="@+id/text_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/background_clr"
android:layout_below="@+id/tab_tv_two"
android:text="@string/options_dialog_menu_Text_Size"
android:textSize="27px"
android:onClick="onClick"
android:clickable="true"
/>
<TextView
android:id="@+id/Options_clr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/brightness_ctrl"
android:layout_below="@+id/text_size"
android:text="@string/options_dialog_menu_Color_Options"
android:textSize="27px"
android:onClick="onClick"
android:clickable="true"
/>
<TextView
android:id="@+id/brightness_ctrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/background_clr"
android:text="@string/options_dialog_menu_Brightness_color"
android:textSize="27px"
android:onClick="onClick"
android:clickable="true"
/>
<TextView
android:id="@+id/backToBasics"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/brightness_ctrl"
android:text="@string/options_dialog_menu_Back_To_Basics"
android:textSize="27px"
android:onClick="onClick"
android:clickable="true"
/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
我认为你需要使用dp而不是像素。 – kosa 2012-03-28 20:26:43