Android中设置半个屏幕大小且居中的button布局 (layout_weight属性)
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOQAAAF2CAYAAAB+jjRxAAAgAElEQVR4Ae2d2Y9dxbWH1+k+Pbjdnmc8YBsDZjQ2hMmMCYQAIYBQRFAmpJvo6ioPUV6vFOm+5G/Ia6JIiaLoCkRMGEKABIjDPBgQGBuPbexut7vd7nm89RVUU25O2ybmugrqV2L71Nm7dtWqb9Vvr9q1dx8qZjbhNiUREAEIVOqscdkaW3TVLdZ6wSZrWrjMKg0NNjE25vlU3HGrmI32HbOBPTus6/V/WPdbL9jEQK8/3rz4LFtz73/Y3HUXmzU220Rdvdn4uNWNDFnP3h2255Hf2LHd7/uy/LN+/Xr72c9+ZnV1dTYxMWHVySPKiEDpBJwomledZ0tuvs9aVq1z2qy3gf0f2lh/j42PDLvQNWF19fVW3zTT6mfPteblZ9ui1jutYdZcO/zcozY+5ERZqbe6pharzmi1pmrFWpsabGx8wnqHqn6f1X9WcggxbJ89WrpT1P9yCXjBNVjTvEU25iLg4L6dZtWqNcye50VHaKy4SDky4I6177P61rnWtOxsJ855TlDjnltdxYVPJ+wGF1WvWDHfrl61yN5t77andx6yCSdmomucEOKYq1OCjKkoLwIQcOIY3L/LDj75R5u1fqPNWLHWGuYssLpqg42PjrrjburpIly17iwb7++1ofYD1vXiE9b97is2MTIwyXDcRcSWap1dsmyeLZ/TYlv3dti4O7fi6p+aEOKoq1tT1qlk9F0EHAGmnce2v2kN8xbYrPM22EhXh40c63Za/OQe0oW4uqYmd3yxm9LW2dH33rDhA7sn2REniZJ1dRXr7Buy9uYBWzOv1fZ291un0+NUSSLIkZERCXKSoDIiMIUA0a5n24vm5pLWeu6l1rxkpVWamt100y3ojI3aSE+3HXNRsee9V2340N4pZ/sZq3UPDttL+zpsVnPVRpyYuwfcPaibrk6Zsbr1nnEbHBz0gqQi3UN+Bqd2FE+AqNXdYT1OdM3L17p7xTk22tPlouegm8LOt2rzDOvft8P6dr7tV1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vV6VwJSJC5ekZ2FUlAgizS7ep0rgQkyFw9I7uKJCBBFul2dTpXAhJkrp6RXUUSkCCLdLs6nSsBCTJXz8iuIglIkEW6XZ3OlYAEmatnZFeRBCTIIt2uTudKQILM1TOyq0gCEmSRblencyUgQebqGdlVBIFqtXpcP6v79u2b3DExMTGZHx8fN77zOTY2dtxnOMbx+JzJk5URARE4KYG6ujrbvn37ceWqW7ZsmRRVEBiCGxkZ8dvQ0JANDAxMboODgzY8POyPIVQ2UhBm+DyuFX0RARE4IYFKpWJsx8fLT04JouITcYaIGOc5NnU7YYs6KAIi8BkCiDBO/weQvdh6zCosbAAAAABJRU5ErkJggg==" alt="" />
上图中。按钮的大小为屏幕的一半,然后居中显示在布局中央,每一个人心中都有自己的答案,看看我的方法吧,布局布局xml例如以下 :
<? xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1" > <!-- 1.将LinearLayout的layout_weight设置为1 --> <!-- 2.将Button的layout_width设为0dp, 而且将layout_weight设置为0.5 -->
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:textSize="13sp"
android:text="@string/button_text" >
</Button> </LinearLayout>
这里有几个关键点:
- 布局为LinearLayout,以便能够设置layout_weight。
- 设置LinearLayout的android:weightSum的值为1;
- 将Button的layout_width设置为0dp;
- 将Button的layout_weight的值设置为0.5。 即上面的android:weightSum的一半。
子空间的宽度算法能够參考例如以下公式, 子控件宽度 = 子控件layout_width + 子控件的layout_weight * 父控件的宽度 / 父控件的layout_weight, 对照上面的样例就是子控件的宽度 = 0.5 * 父控件的宽度 / 1 = 父控件宽度 * 0.5。 由于父控件的宽度为match_parent,所以父控件宽度的宽度为整个屏幕的宽度,所以子控件的宽度 = 0.5 * 整个屏幕的宽度 = 半屏宽度。
Android中设置半个屏幕大小且居中的button布局 (layout_weight属性)的更多相关文章
- 在Eclipse Android中设置模拟器屏幕大小
在Eclipse Android中设置模拟器屏幕大小是本文要介绍的内容,主要是来了解并学习Eclipse Android中模拟器的设置,具体关于Eclipse Android内容的详解来看本文. 方法 ...
- Android中使用ViewPager实现屏幕页面切换和页面切换效果
之前关于如何实现屏幕页面切换,写过一篇博文<Android中使用ViewFlipper实现屏幕切换>,相比ViewFlipper,ViewPager更适用复杂的视图切换,而且Viewpag ...
- Android 如何设置 WebView 的屏幕占比
Android 如何设置 WebView 的屏幕占比 由于 Android 适用于具有各种屏幕尺寸和像素密度的设备,因此您在设计网页时应将这些因素纳入考虑范围,以便您的网页始终以合适的尺寸显示. We ...
- IIS 7 中设置文件上传大小的方法
在IIS 6.0中设置文件上传大小的方法,就是配置如下节点: <system.web> <httpRuntime maxRequestLength="1918200&quo ...
- Android中设置TextView的颜色setTextColor
tv.setTextColor(Color.parseColor("#FFFFFF")); tv.setTextColor(Color.WHITE); tv.setTextColo ...
- 【转】Android中设置TextView的颜色setTextColor--代码中设置字体颜色
原文网址:http://www.cnblogs.com/myphoebe/archive/2012/01/06/2314728.html android中设置TextView的颜色有方法setText ...
- 【转】Android中设置TextView的颜色setTextColor
原文网址:http://www.cnblogs.com/myphoebe/archive/2012/01/06/2314728.html android中设置TextView的颜色有方法setText ...
- [转]Android中设置TextView的颜色setTextColor
[转自]http://txlong-onz.iteye.com/blog/1249609 Android中设置TextView的颜色setTextColor android中设置TextView的颜色 ...
- IIS 6和IIS 7 中设置文件上传大小限制设置方法,两者是不一样的
在IIS 6.0中设置文件上传大小的方法,只要设置httpRuntime就可以了 <system.web> <httpRuntime executionTimeout="3 ...
随机推荐
- Linux red hat 核心版下安装Nginx
不要安装核心版的Linux,不要安装核心版的Linux,不要安装核心版的Linux重要的事情要说3遍.心血来潮突然想在Linux下安装Nginx,但是在安装的国程中发现了很多问题.nginx 基本安装 ...
- SQL SERVER-union
UNION 操作符用于合并两个或多个 SELECT 语句的结果集. 请注意,UNION 内部的每个 SELECT 语句必须拥有相同数量的列.列也必须拥有相似的数据类型.同时,每个 SELECT 语句中 ...
- windows server 2008开机自动登陆无密码,关机不必写原因
运行secpol.sec接下来,在弹出的“本地安全策略”对话框中,依次展开左边树图到“本地策略”-“安全选项”,在右边可以找到“交互式登录 无须按 Ctrl+Alt+Del”,双击该项设置为“已启用” ...
- Remove Duplicates from Sorted List II 解答(有个比較特殊的case leetcode OJ没有覆盖)
昨天被考了一道数据结构题,当时的实现比較一般.回来翻看leetcode,果然是上面的题.遂解之. accept之后翻看discuss别人的解法.发现非常多能够accept的代码都过不了我设计的一个ca ...
- jms及active(jdk api)的实现
在企业中,分布式的消息队列需要实现的问题: 1.不同的业务系统分别处理同一个消息(订阅发布),同一个业务系统负载处理同一类消息(队列模式) 2.消息的一致性问题,在互联网公司中一般不要求强一致性,一般 ...
- 从ORA-27300,ORA-27301到ORA-00064
近期因为session数量添加,须要调整session,也就是要调整process參数. 看是比較简单的一个问题,却遭遇了ORA-27300,ORA-27301.因为这个涉及到了有关内核參数k ...
- 通达OA 小飞鱼OA实施法:以项目管理的方式来推进工作流设计项目实施
做工作流设计的项目时,有时有几十个之多的流程须要做,并且时间有限,怎样把这些流程在有限的时间内设计完毕,并且达到预定要求成为这个项目须要解决的主要问题. 为了更好的完毕此次的工作流项目实施,在这里借鉴 ...
- 唯品会API网关设计与实践--转
原文地址:https://609518.kuaizhan.com/86/70/p4108366952248f 刘璟宇Leo 唯品会资深研发工程师,在大型高性能分布式系统设计和开发方面有丰富的经验.目前 ...
- 问题集锦 ~ jQuery
#addClass失败 $target.addClass('show'); show 这个单词可能和内部某处起冲突了吧,有时成功有时失败,只能换个class名了,难受……
- AOJ GRL_1_B: Shortest Path - Single Source Shortest Path (Negative Edges) (Bellman-Frod算法求负圈和单源最短路径)
题目链接: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_B Single Source Shortest Path ...