如何在像Facebook Android中的屏幕底部显示三个按钮? [英] How to show three buttons at the bottom of the screen like facebook in android?

查看:253
本文介绍了如何在像Facebook Android中的屏幕底部显示三个按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与Android合作,我需要一个XML设计中,我需要我的屏幕下方有三个按钮水平始终。就像在Android的Facebook应用程序,它们在屏幕底部的三个按键(状态,照片,入住) - 同样地,我需要有三个按钮,以及总是在我的应用

I am working with android and I need to make an XML design in which I need to have three buttons at the bottom of my screen horizontally always. Just like facebook application in android, they have three buttons at the bottom of the screen (Status, Photo, Check In) - similarly I need to have three buttons as well always in my application.

会是怎样的设计,这种布局的?

What will be the design for this kind of layout?

我试着用下面的XML设计,但它不以某种方式工作,他们都来了垂直 -

I tried with the below XML design but it doesn't work somehow and they all are coming vertical -

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/db1_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="@string/cow"
        android:layout_weight="0"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="1"
        android:gravity="center|bottom"
        android:orientation="vertical" >

        <Button
            android:id="@+id/button1"
            style="?android:attr/buttonStyleSmall"
            android:layout_width="145dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|center"
            android:text="ButtonA" />

        <Button
            android:id="@+id/button2"
            style="?android:attr/buttonStyleSmall"
            android:layout_width="145dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|center"
            android:text="ButtonB" />

        <Button
            android:id="@+id/button3"
            style="?android:attr/buttonStyleSmall"
            android:layout_width="145dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|center"
            android:text="ButtonC" />
    </LinearLayout>

</LinearLayout>

我只需要在屏幕水平就像Facebook的底部显示三个按钮始终显示并排(相互接触)。这是可能的吗?

I just need to show three buttons at the bottom of the screen horizontally just like facebook shows always side by side (touching each other). Is this possible to do?

按钮名称可以是 - 按钮a,ButtonB和ButtonC

Button names can be - ButtonA, ButtonB and ButtonC

推荐答案

下面使用的布局,我认为它可以帮助您

Use below layout, i think its help you

<LinearLayout 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:orientation="vertical" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0"
        android:gravity="center"
        android:text="cow"
        android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>

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

    <Button
        android:id="@+id/button1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="ButtonA" />

    <Button
        android:id="@+id/button2"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="ButtonB" />

    <Button
        android:id="@+id/button3"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="ButtonC" />
</LinearLayout>

这篇关于如何在像Facebook Android中的屏幕底部显示三个按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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