解决LinearLayout中控件不能居右对齐
转载自:http://lgb168.blog.163.com/blog/static/49674438201172492935235/
2011-08-24 21:35:25| 分类: Android | 标签:android linearlayout 对齐 |举报|字号 订阅
在LinearLayout布局时使用右对齐(android:layout_gravity="right")控件对齐方式不生效,需要设置 android:layout_weight="1" 才能右对齐控件,原因在于后者把位置平分了。
<LinearLayout android:gravity="right" android:layout_margin="2dip"
android:orientation="horizontal"android:layout_gravity="center_vertical"
android:layout_width="wrap_content"android:layout_height="wrap_content"
android:layout_weight="1" >
<Button android:id="@+id/btnCommonExpress" android:width="50dip"
android:layout_width="wrap_content"android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:text="常用" />
<Button android:id="@+id/btnAll" android:width="50dip"
android:layout_width="wrap_content"android:layout_height="wrap_content"
android:layout_alignParentRight="true"android:layout_alignRight="@+id/btnCommon"
android:text="所有" />
</LinearLayout>
解决LinearLayout中控件不能居右对齐的更多相关文章
- [转]解决LinearLayout中控件不能居右对齐
在LinearLayout布局时使用右对齐(android:layout_gravity="right")控件对齐方式不生效,需要设置 android:layout_weight= ...
- 48.UIButton上的字体居右对齐
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; button.titleLabel.textAlignment = NSTe ...
- c#中解决winform中控件不能输入汉字的办法
设置控件的ImeMode属性 如: textBox.ImeMode = System.Windows.Forms.ImeMode.On; 其中枚举有如下值:
- select使用css居右对齐
select{ direction: rtl; } 下面的方法无效 select{ text-align: right; }
- 解决statusStrip控件上的项目不能靠右对齐的问题
在c#中用到了状态栏控件StatusStrip,但当我想把StatusStrip上某个StatusLabel靠右对齐时出了问题. 按照MSDN中的办法,是设置ToolStripStatusLabel的 ...
- LinearLayout中组件右对齐
在LinearLayout中,如果将其定位方向设为横向排列:android:orientation="horizontal",那么这个布局中的控件将自左向右排列. 但有时会有这样的 ...
- form表单中控件较多,加载完成后切换页面都很慢的解决方法
form表单中控件较多,加载完成后点击都很慢,为什么?我一页面中form表单里面上百个控件(如input.select.radio.checkbox等),还有一些js脚本,加载速度还可以,都能全部显示 ...
- pageControl设置不居中显示,居左或居右
UIPageControl控件,默认是居中显示的,如下图: 在很多的APP中,会看到pageControl是居左或居右显示的,如下图: 如何控制pageControl的位置显示呢? 设置为居右的代 ...
- LinearLayout控件
LinearLayout是线性布局控件,它包含的子控件将以横向或竖向的方式排列,按照相对位置来排列所有的widgets或者其他的containers,超过边界时,某些控件将缺失或消失.因此一个垂直列表 ...
随机推荐
- java jar
http://www.cnblogs.com/shirui/p/5270969.html Java之 将程序打包成jar包 准备材料: 1.java文件: Helloworld.java pack ...
- 面试题目-c和c++的区别
在很大程度上,标准C++是标准C的超集.实际上,所有C程序也是C++程序,然而,两者之间有少量区别.下面简要介绍一下最重要的区别. 1. 在C++中,局部变量可以在一个程序块内在任何地方声明,在 ...
- MonoRail MVC应用(2)-构建多层结构的应用程序
习惯了分层结构的.NET开发了,当然也是分层有优势,所以在使用MonoRail进行网站构建时,首先考虑到的问题就是MonoRail如何应对分层的结构.问题1:MonoRail在WEB层没有根目录,必须 ...
- SOD 精选细节--常用工具
要明白一个思想: SOD 只是帮你拼接sql语句, 用简单的方式来帮你实现. 不要理解错了.这很重要的! 查询: TB table=new TB(); table.Name="111& ...
- Threading in C#
http://www.albahari.com/threading/ PART 1: GETTING STARTED Introduction and Concepts C# supports par ...
- JS创建自定义对象
普通对象的创建: 创建对象: 1.people = new Object(); people.name = "lin"; people.age = "26“; 2.创建字 ...
- MongoDB error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js(转)
rror: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js 一般这种情况就是:自己指定的数据库,所以不能.自动加 ...
- C#移动无标题栏窗体的四种代码
第一种采用,需注意窗体上的控件是否把窗体覆盖了...MouseDown.MouseMove.MouseUp事件应该是鼠标所处位置最顶层的控件的事件在窗体的类中声明两个变量private Point m ...
- hdu 2029
PS: 逻辑问题... 代码: #include "stdio.h"#include "string.h"int main(){ char a[110]; i ...
- mongodb 几个要注意的问题
1. moongo db 会尽量将 所有 索引和 热数据 放入内存中来进行比较,从而来获得更好的查询速度,同时,mongodb在写的时候,也是先写入内存,然后定期同步到磁盘上面去,这样可以达成顺序写的 ...