我有一个activity.xml文件,其中包含一个背景图和一个按钮,该按钮也有一个背景图,在普通屏幕上运行正常,但在xlarge或大屏幕上运行时,按钮的位置会改变。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="@drawable/menu"
android:layout_margin="@dimen/my_view_margin"
>
<LinearLayout
android:layout_width="300px"
android:layout_height="200px"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="172dp"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="60px"
android:background="@drawable/bt"
android:text="Button" />
</LinearLayout>
</RelativeLayout>
以下是代码,下面是不同屏幕的图像。
抱歉,因为声望不够,无法添加图片。