【发布时间】:2014-10-24 23:40:22
【问题描述】:
我已经使用相对布局创建了一个具有 hdpi 密度的正常屏幕尺寸的布局。但我知道一些具有相同屏幕尺寸的设备,底部被裁剪为 7-8 毫米,用于 3 个 android 常用按钮(主页等)。
现在我想知道如何创建适合该类型设备的布局,因为现在它会将我的布局裁剪为 7 毫米?
谢谢。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/prime"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#8B008B"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="5dp"
tools:context="com.example.testznanja.MainActivity" >
<RelativeLayout
android:id="@+id/rl"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@drawable/question_layout" >
<TextView
android:id="@+id/questionText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
<Button
android:id="@+id/beginTest"
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_below="@+id/infoPanel"
android:layout_marginTop="25dp"
android:background="@drawable/button_normal"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/beginTest"
android:layout_marginTop="18dp"
android:background="@drawable/button_normal"
android:text="Button" />
<Button
android:id="@+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/button2"
android:layout_marginTop="18dp"
android:background="@drawable/button_normal"
android:text="Button" />
<Button
android:id="@+id/button4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/button3"
android:layout_marginTop="18dp"
android:background="@drawable/button_normal"
android:text="Button" />
<RelativeLayout
android:id="@+id/infoPanel"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_below="@+id/rl"
android:layout_marginTop="25dp"
android:background="@drawable/info_panel_layout"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<TextView
android:id="@+id/questionsAnswers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Skor: 0"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/timer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="right"
android:text="Vreme: 20"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="50:50"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
【问题讨论】:
-
你能把你的xml代码贴出来让我们看看问题吗?
标签: android layout size screen