如何从Android的海誓山盟分隔图标 [英] how to separate icons from eachother android

查看:246
本文介绍了如何从Android的海誓山盟分隔图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在屏幕的底部的一个导航条。我有一组在这个导航栏3个按钮,这些按钮有一个图标,背景按钮有海誓山盟之间没有空格。我在谷歌一直在寻找如何将它们从海誓山盟分隔,但我没有succeded。该questiion是:如何从海誓山盟它们分开?这里是我的xml code:

的main.xml

 <?XML版本=1.0编码=UTF-8&GT?;
<的RelativeLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:方向=垂直
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    ><的TextView
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:文字=@字符串/你好
    />    <的LinearLayout
    机器人:layout_alignParentBottom =真
    机器人:layout_centerHorizo​​ntal =真
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:方向=横向
    机器人:背景=#5E767E
    机器人:比重=中心
    >        <按钮
        机器人:layout_height =WRAP_CONTENT
        机器人:ID =@ + ID /后退
        机器人:layout_width =WRAP_CONTENT
        机器人:背景=@绘制/按钮
        />        <按钮
        机器人:layout_height =WRAP_CONTENT
        机器人:ID =@ + ID /家
        机器人:layout_width =WRAP_CONTENT
        机器人:背景=@绘制/按钮
        />        <按钮
        机器人:layout_height =WRAP_CONTENT
        机器人:ID =@ + ID /下一个
        机器人:layout_width =WRAP_CONTENT
        机器人:背景=@绘制/按钮
        />    < / LinearLayout中>
< / RelativeLayout的>


解决方案

你有没有试过投入之间的空查看?

 <按钮
        机器人:layout_height =WRAP_CONTENT
        机器人:ID =@ + ID /后退
        机器人:layout_width =WRAP_CONTENT
        机器人:背景=@绘制/按钮
        />
<景观的android:layout_width =2DIP机器人:layout_height =1dip/>
        <按钮
        机器人:layout_height =WRAP_CONTENT
        机器人:ID =@ + ID /家
        机器人:layout_width =WRAP_CONTENT
        机器人:背景=@绘制/按钮
        />
<景观的android:layout_width =2DIP机器人:layout_height =1dip/>
        <按钮
        机器人:layout_height =WRAP_CONTENT
        机器人:ID =@ + ID /下一个
        机器人:layout_width =WRAP_CONTENT
        机器人:背景=@绘制/按钮
        />

在宽度和高度是根据自己的需要播放。它通常是卓有成效的我。

i have a navigation bar on the bottom of the screen. I have a set of 3 buttons in this navbar, the buttons have an icon as background button there's no space between eachother. I've been searching in Google how to separate them from eachother but i haven't succeded. The questiion is: how can i separate them from eachother? here's is my xml code:

Main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />

    <LinearLayout 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:background="#5E767E"
    android:gravity="center"
    >

        <Button 
        android:layout_height="wrap_content" 
        android:id="@+id/back" 
        android:layout_width="wrap_content"
        android:background="@drawable/button"
        />

        <Button 
        android:layout_height="wrap_content" 
        android:id="@+id/home" 
        android:layout_width="wrap_content"
        android:background="@drawable/button"
        />

        <Button 
        android:layout_height="wrap_content" 
        android:id="@+id/next" 
        android:layout_width="wrap_content" 
        android:background="@drawable/button"
        />

    </LinearLayout>


</RelativeLayout>

解决方案

Have you tried putting an empty View in between?

<Button 
        android:layout_height="wrap_content" 
        android:id="@+id/back" 
        android:layout_width="wrap_content"
        android:background="@drawable/button"
        />
<View android:layout_width="2dip" android:layout_height="1dip"/>
        <Button 
        android:layout_height="wrap_content" 
        android:id="@+id/home" 
        android:layout_width="wrap_content"
        android:background="@drawable/button"
        />
<View android:layout_width="2dip" android:layout_height="1dip"/>
        <Button 
        android:layout_height="wrap_content" 
        android:id="@+id/next" 
        android:layout_width="wrap_content" 
        android:background="@drawable/button"
        />

Play with the width and height of it to suit your needs. It usually does the trick for me.

这篇关于如何从Android的海誓山盟分隔图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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