嗯,我有activity.xml我有一个背景图像和一个按钮,它也有一个背景图像在普通屏幕上运行良好,但是当我在xlarge上运行它时或大屏幕按钮的位置改变如何使Android应用程序适合所有屏幕尺寸
<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>
这是代码的上方和下方是不同的画面的图像
不能增加图象引起不必须足够的声誉
首先,你将要开始使用'dp'值,而不是'px'值。并且,阅读这些链接。绰绰有余,以达到你所期望的。 http://developer.android.com/guide/practices/screens_support.html和http://android-developers.blogspot.in/2011/07/new-tools-for-managing-screen-sizes.html –
是的使用DP而不是PX。为什么这个线性内部相对? 不要修复高度,宽度这是更大的设备的问题.. –
试试我的答案它应该适用于所有设备.. –