对齐按钮的布局的底部 [英] Align buttons to the bottom of the layout

查看:128
本文介绍了对齐按钮的布局的底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对齐两个按钮在屏幕的底部如下。我想在这个类似的问题但没有给出luck.how的XML办呢?

i want to align two buttons to the bottom of the screen as follows. i tried the xml given in this similar question but no luck.how to do it ?

这样的 -

,这应该是没有在底部的间距

this should be without the spacing in the bottom

推荐答案

这是你需要使用的属性:

This is the property you need to use:

android:layout_alignParentBottom="true"

请尝试使用下面的XML和自定义按钮的外观,只要你喜欢:

Try using the following XML and customize your button appearance as you like:

<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"
android:background="#d1000000"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MyActivity">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:orientation="horizontal">

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="PREV"
        android:layout_marginRight="-5dp"/>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="NEXT"
        android:layout_marginLeft="-5dp"/>

</LinearLayout>
</RelativeLayout>

这篇关于对齐按钮的布局的底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆