首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在RelativeLayout中将安卓按钮与底部对齐?

在RelativeLayout中将安卓按钮与底部对齐?
EN

Stack Overflow用户
提问于 2011-01-13 05:48:06
回答 4查看 51K关注 0票数 17

我正在尝试使用RelativeLayout将按钮与屏幕的左下角和右下角对齐。我想这样做是为了在不同的屏幕尺寸上保持相同的相对布局。目前,我屏幕上的按钮根据屏幕的分辨率向上/向下移动。320x480使按钮在屏幕上的位置高于480x800。我试着让我的屏幕在两种尺寸下看起来是一样的。

EN

Stack Overflow用户

发布于 2011-01-14 00:33:25

示例:

代码语言:javascript
运行
复制
<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>
票数 5
EN
查看全部 4 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4674416

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档