我正在开发一个21.5英寸android设备的应用程序。我已经尝试了下面的代码并在10英寸的仿真器中测试。它看起来不错。但我想知道是否使用相对布局或线性布局与重量是好的。因为我不想在21.5英寸屏幕上出现布局下方的空白区域。请建议。21.5英寸屏android设备的布局设计
我的布局代码。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:contentDescription="@string/app_name"
android:src="@drawable/image1" />
<com.acuvue.kiosk.view.CustomTextView
android:id="@+id/customTextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView1"
android:layout_centerInParent="true"
android:layout_marginTop="100dp"
android:gravity="center"
android:text="@string/please_choose"
android:textSize="50sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/customTextView1"
android:layout_marginTop="100dp"
android:baselineAligned="false"
android:orientation="horizontal"
android:weightSum="2" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" >
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/hello_world"
android:textColor="#ffffff" />
</LinearLayout>
</LinearLayout>
哪个设备提供21.5英寸的屏幕? – 2014-11-06 05:38:18
@HareshChhelana hp slate 21 android平板电脑。 – 2014-11-06 05:39:25