方法一:

<RelativeLayout android:id="@+id/relativeTop"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
> <Button
android:id="@+id/btnGetMp3s"
android:text="@string/strGetMp3List"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_toLeftOf="@id/txtHide"
/>
<TextView android:id="@+id/txtHide" android:layout_width="25" android:layout_height="1"
android:layout_centerHorizontal="true" />
<Button
android:id="@+id/btnExitSys"
android:text="@string/strExitSys"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/txtHide" />
</RelativeLayout>

方法二:

<LinearLayout android:layout_width="fill_parent"

                android:layout_height="wrap_content"

                android:orientation="horizontal"

                style="@android:style/ButtonBar"

                >

                <Button android:id="@+id/btn_listview"

                    android:layout_height="wrap_content"

                    android:layout_width="0dp"

                    android:layout_weight="1"

                    android:text="ListView"/>

                <Button android:id="@+id/btn_emptyview"

                    android:layout_height="wrap_content"

                    android:layout_width="0dp"

                    android:layout_weight="1"

                    android:text="EmptyView"/>      

            </LinearLayout>

从零开始学android-一行两个按钮居中 布局的更多相关文章

  1. 从零开始学android -- Service

    废话不多说了,Service是四大组件之一,是一个后台处理长时间运行在主线程不需要依赖ui界面显示的应用组件,切记不能在service中做耗时操作,会阻塞主线程,要做也要在service中开个子线程做 ...

  2. 第24章、OnLongClickListener长按事件(从零开始学Android)

    在Android App应用中,OnLongClick事件表示长按2秒以上触发的事件,本章我们通过长按图像设置为墙纸来理解其具体用法. 知识点:OnLongClickListener OnLongCl ...

  3. 从零开始学android开发- layout属性介绍

    android:id 为控件指定相应的ID android:text 指定控件当中显示的文字,需要注意的是,这里尽量使用strings.xml文件当中的字符串 android:gravity 指定Vi ...

  4. 从零开始学android开发-布局中 layout_gravity、gravity、orientation、layout_weight

    线性布局中,有 4 个及其重要的参数,直接决定元素的布局和位置,这四个参数是 android:layout_gravity ( 是本元素相对于父元素的重力方向 ) android:gravity (是 ...

  5. 从零开始学android开发- 应用程序窗体显示状态操作requestWindowFeature

    我们在开发程序是经常会需要软件全屏显示.自定义标题(使用按钮等控件)和其他的需求,今天这一讲就是如何控制Android应用程序的窗体显示. 首先介绍一个重要方法那就是requestWindowFeat ...

  6. 从零开始学android开发-四大组件之一 Activity

    1.Activity是Android四大组件(Application Components)之一,简单来说Activity就是平常所见到的用户界面,一般情况下,一个Activity所占的窗口是满屏的, ...

  7. 从零开始学android开发-详细谈谈intent的startActivityForResult()方法

    1.两种实现activity跳转的方法 实现activity的跳转主要有两种方法,startActivity()和startActivityForResult();例如activity A跳转到act ...

  8. 从零开始学android -- 简易的socket通信

    先来介绍下socket,网上摘抄点资料,免得自己打字了 网络中进程之间如何通信? 本地的进程间通信(IPC)有很多种方式,但可以总结为下面4类: 1.消息传递(管道.FIFO.消息队列) 2.同步(互 ...

  9. 从零开始学android开发-项目打包发布

    右键项目 选择[android tools]-[export signed application package] 点击[next] 如果没有keystore可以选择[create new keys ...

随机推荐

  1. 使用SAE部署Flask,使用非SAE flask版本和第三方依赖包的方法

    目前SAE的Flask的版本为0.7,但是我从学习开始的flask版本就已经是0.10了,而且一些扩展都是使用的0.10以后的from flask.ext.特性进行引入的.所以需要修改SAE的环境. ...

  2. bzoj1412

    比较裸的最小割 注意狼和羊的领地可以通过空地相连 ;       dx:..] ,,,-);       dy:..] ,,,); type node=record        next,point ...

  3. 初探数位dp

    数位dp有着很明显的特点,一般来说是给定区间[l,r]求满足某种条件区间中的数有多少个 朴素解法一般是O(n)的而n往往很大(10^8起步) 这时候我们就要想办法优化,于是就有了数位dp 数位有两个基 ...

  4. NOI2009植物大战僵尸

    这题应该分两步来做: 1.拓扑排序,去掉无敌点 2.求最大闭合子图 需要注意几点: 1.拓扑排序时,如果(i,j)可以攻击到(x,y),那么增加(x,y)的入度,而不是(i,j)的入度 因为入度代表着 ...

  5. Spark(1) - Getting Started with Apache Spark

    Introduction Apache Spark is a general-purpose cluster computing system to process big data workload ...

  6. java中正则表达式

    在<java编程思想>中,java中的 \\ 表示“我要插入一个正则表达式的反斜线,所以其后的字符具有特殊的意义.”如果想插入一个普通的反斜线,那么应该使用 \\\\. 理解: 我们使用的 ...

  7. 【转】跟着开涛学SpringMVC

    跟着开涛学SpringMVC 第一章源代码下载 博客分类: 跟开涛学SpringMVC 跟开涛学SpringMVC  源代码请到附件中下载. 其他下载: 跟着开涛学SpringMVC 第一章源代码下载 ...

  8. ejabberd的多域名(domain)设置

    在ejabberd中可以支持多个domain,我讲一下我的配置过程我的ejabberd系统是:ejabberd server+sql server+openldap+gateway.我总共使用了5台机 ...

  9. SGU 134 Centroid

    题意:给出一个树,每个点有一个value,value的意义是去掉这个点之后所有连通分量中点最多的那个连通分量的点数,这棵树的重心为所有点value的最小值,求重心,及重心都有谁. 解法:貌似是个树形d ...

  10. Jmeter性能测试之如何写Java请求测试用例类

    一. 引言: 最近工作中的一个项目要求做性能测试,该项目由提供服务的几个应用组成,选用的框架是阿里巴巴公司开源的服务框架Dubbo.关于Dubbo的介绍,网上也有很多资料,本人只是做了粗略的了解,没有 ...