Android平均分布的布局图像的下一行
Android下一行平均分布图片的布局
这是一个非经常见的需求,比方有三个图片button,须要在底部三个平均,比方下个样例:
下面是布局文件
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
>
<ImageButton
android:id="@+id/button_start"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/button_start"
android:background="@android:color/transparent"
/>
<ImageButton
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:layout_weight="1"
android:src="@drawable/button_heat" />
<ImageButton
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/button_close"
android:background="@android:color/transparent" />
</LinearLayout>
对应解释:
- 必须採用ImageButton 而且将图片设为前景(即android:src),用button背景或ImaageView的src 均不行。后者会造成图片拉伸填满整行。
- android:background="@android:color/transparent" 是防止ImageButton 出现缺省的按钮背景从而破坏效果。
- android:layout_width="match_parent" 和 android:layout_weight="1" 是配合达成平均分布效果,前者保存每一个button拉伸到相同长度。拉伸控制后,后面的比例指示1:1:1
版权声明:本文博客原创文章,博客,未经同意,不得转载。
Android平均分布的布局图像的下一行的更多相关文章
- Android开发-之五大布局
在html中大家都知道布局是什么意思了,简单来说就是将页面划分模块,比如html中的div.table等.那么Android中也是这样的.Android五大布局让界面更加美化,开发起来也更加方便.当然 ...
- Android精通:TableLayout布局,GridLayout网格布局,FrameLayout帧布局,AbsoluteLayout绝对布局,RelativeLayout相对布局
在Android中提供了几个常用布局: LinearLayout线性布局 RelativeLayout相对布局 FrameLayout帧布局 AbsoluteLayout绝对布局 TableLayou ...
- android 很多牛叉布局github地址(转)
原文地址 http://blog.csdn.net/luo15309823081/article/details/41449929 点击可到达github-------https://github.c ...
- Android中的LinearLayout布局
LinearLayout : 线性布局 在一般情况下,当有很多控件需要在一个界面列出来时,我们就可以使用线性布局(LinearLayout)了, 线性布局是按照垂直方向(vertical)或水平方向 ...
- 一个div,包含两个div,调整文字位置和div平均分布
网页中经常会用到,一个div下平均分布两个小的div,两个小的div,显示的内容为图片还比较好处理,显示文字则不好控制效果,今天写了一个如图效果的 html: <div class=" ...
- 一个div,包含三个小的div,平均分布的样式
从11月份开始,自学前端开发,写静态页面中,经常用到一个大的div下包含三个小的div,平均分布div大小样式,写过多次,也多次忘记,每次都要现找资料,不想之后,在这么麻烦,索性今天自己记录一下,方便 ...
- Android性能优化之布局优化
最新最准确内容建议直接访问原文:Android性能优化之布局优化 本文为Android性能优化的第二篇——布局优化,主要介绍使用抽象布局标签(include, viewstub, merge).去除不 ...
- Android中的五大布局
Android中的五大布局 1.了解布局 一个丰富的界面总是要由很多个控件组成的,那我们如何才能让各个控件都有条不紊地 摆放在界面上,而不是乱糟糟的呢?这就需要借助布局来实现了.布局是一种可用于放置很 ...
- 【转】Android性能优化之布局优化篇
转自:http://blog.csdn.net/feiduclear_up/article/details/46670433 Android性能优化之布局优化篇 分类: andorid 开发2015 ...
随机推荐
- unix网络编程之listen()详解
转自于:http://blog.csdn.net/ordeder/article/details/21551567 Unix网络编程描述如下: #include <sys/socket.h> ...
- Connection reset by peer问题分析
extremetable导出excel,弹出一个下载窗口,这时不点下载而点取消,则报下面的异常: ClientAbortException Caused by: java.net.SocketExce ...
- Codeforces Round #189 (Div. 2)
题目地址:http://codeforces.com/contest/320 第一题:基本题,判断mod 1000,mod 100.,mod 10是不是等于144.14.1,直到为0 代码如下: #i ...
- Unix/Linux环境C编程新手教程(24) MySQL 5.7.4 for Red Hat Enterprise 7(RHEL7)的安装
远观历史, MySQL的主要目的是为了可以在单处理器核心的商业服务器上执行.现在MySQL的一个变化用户可能不会注意到,那就是甲骨文已经開始又一次架构MySQL的代码,使它大量的模块化.如软件解析器, ...
- linux登录windows服务器
在公司同时也兼顾了王老师会议网站的任务,我喜欢用linux,而会议网站托管在windows系统上,虽然装了双系统,但我还是比较懒,不喜欢经常切换系统.还好,linux可以实现登录windows服务器. ...
- “/” 应用程序中的服务器错误 - IIS 发布错误
解决方法, 将bin目录下的全部文件复制到iis下
- boost ini
#include <boost/property_tree/ptree.hpp>#include <boost/property_tree/ini_parser.hpp> .. ...
- 好消息:8月25日广州嵌入式Linux开发免费项目约定你
8月18日,粤嵌深圳分校举行了盛大的免费嵌入式项目体验,众多嵌入式爱好者排队参加项目体验的火爆场景仿佛还在眼前,体验效果得到学员一致好评.时隔一周,粤嵌广州总部也不容落后,在粤嵌广州总部举办<嵌 ...
- 关于new enhancement的一些知识
关于new enhancement sap源程序里也给我们留了很多. 以下例句point .section.spot说明这些知识点. 1.不管是point还是section 都是基于spot的,spo ...
- 【linux】内核源代码下载与阅读
原创,转载时请注明,谢谢.邮箱:tangzhongp@163.com 博客园地址:http://www.cnblogs.com/embedded-tzp Csdn博客地址:http://blog. ...