我有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>
Run Code Online (Sandbox Code Playgroud)
这是上面和下面的代码是不同屏幕的图像
无法添加图片因为没有足够的声誉
对所有布局使用权重而不是给出常量值,因为权重是屏幕的%类型.默认情况下,清单支持屏幕视图为true.
如果您认为有任何时候,那么添加尺寸值是不可能的{folder contains dimens.xml}
| 归档时间: |
|
| 查看次数: |
35064 次 |
| 最近记录: |