Android的lyout杆按钮一起 [英] Android lyout stick buttons together

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

问题描述

下面是我的布局

    <LinearLayout
    android:id="@+id/toolbar"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@id/image"
    android:layout_gravity="bottom"
    android:layout_marginTop="5dp"
    >


    <Button
        android:layout_weight="1.0"
        android:id="@+id/button1"
        style="@style/ActionButtonText"
        android:background="@drawable/action_button_left"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:text="Button" >
    </Button>

    <Button
        android:layout_weight="1.0"
        android:id="@+id/button1"
        style="@style/ActionButtonText"
        android:background="@drawable/action_button_center"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:text="Button" >
    </Button>

    <Button
        android:layout_weight="1.0"
        android:id="@+id/button1"
        style="@style/ActionButtonText"
        android:background="@drawable/action_button_center"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:text="Button" >
    </Button>

    <Button
        android:layout_weight="1.0"
        android:id="@+id/button1"
        style="@style/ActionButtonText"
        android:background="@drawable/action_button_right"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:text="Button" >
    </Button>

这是他们如何看

我所试图做的是删除按钮之间的差距,使他们看起来粘在一起像这样

What i am trying to do is remove gap between buttons so they look stuck together like this

我已经打了填充和利润,但不能得到它的工作。我怎样才能实现呢?
谢谢

I have played with padding and margins but couldn't get it working. How can I achieve it? Thanks

推荐答案

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="bottom"
    android:layout_marginTop="5dp" >


    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1.0"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:text="Button" >
    </Button>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="-10dp" <------ it will work....( minus 10)
        android:layout_weight="1.0"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:text="Button" >
    </Button>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="-10dp"
        android:layout_weight="1.0"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:text="Button" >
    </Button>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="-10dp"
        android:layout_weight="1.0"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:text="Button" >
    </Button>

</LinearLayout>

这篇关于Android的lyout杆按钮一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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