我正在尝试使用RelativeLayout将按钮与屏幕的左下角和右下角对齐。我想这样做是为了在不同的屏幕尺寸上保持相同的相对布局。目前,我屏幕上的按钮根据屏幕的分辨率向上/向下移动。320x480使按钮在屏幕上的位置高于480x800。我试着让我的屏幕在两种尺寸下看起来是一样的。
发布于 2013-07-31 12:51:42
我知道这是一个老帖子,但它会出现在搜索结果的顶部,所以我想确认一下也无伤大雅
android:layout_alignParentBottom="true" 在RelativeLayout为我工作。
发布于 2011-01-13 07:47:14
你在使用android:layout_alignParent*吗?无论屏幕大小如何,这都应该证明它是合理的。
其中*是底部、顶部、左侧或右侧
发布于 2011-01-14 00:33:25
示例:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:panel="http://schemas.android.com/apk/res/it.kronplatz"
android:id="@+id/MainLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:id="@+id/ButtonLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_centerHorizontal="true"
android:baselineAligned="false" >
<ImageButton
android:id="@+id/locateMeButton"
android:layout_width="70px"
android:layout_height="70px"
android:layout_marginLeft="5px"
android:src="@drawable/me" >
</ImageButton>
<ImageButton
android:id="@+id/MapCenterButton"
android:layout_width="70px"
android:layout_height="70px"
android:layout_alignParentRight="true"
android:layout_gravity="right"
android:layout_marginRight="5px"
android:src="@drawable/fadenkreuz_klein" />
<Button
android:id="@+id/MapNextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableRight="@drawable/androidmarker" >
</Button>
</RelativeLayout>
</RelativeLayout>https://stackoverflow.com/questions/4674416
复制相似问题