Android LinearLayout布局控件靠右

这是个悲伤而又略带绝望的故事,发生在我和xml布局之间,他气死了我,我删了它。

我说 靠右。

控件非不。

全剧终。

1 <LinearLayout 2 android:layout_width="match_parent" 3 android:layout_height="wrap_content" 4 android:orientation="vertical" 5 android:background="@drawable/bg_personal_major_experience_item_shape" 6 android:layout_marginTop="@dimen/y30" 7 android:layout_marginLeft="@dimen/x30" 8 android:layout_marginRight="@dimen/y30"> 9 <LinearLayout 10 android:layout_width="match_parent" 11 android:layout_height="@dimen/y122" 12 android:orientation="horizontal"> 13 <LinearLayout 14 android:layout_width="match_parent" 15 android:layout_height="match_parent" 16 android:orientation="horizontal" 17 android:layout_weight="1"> 18 <TextView 19 android:layout_width="wrap_content" 20 android:layout_height="wrap_content" 21 android:text="教育背景" 22 android:textColor="@color/colorBlue" 23 android:layout_gravity="center_vertical" 24 android:layout_marginLeft="@dimen/x60" 25 android:textSize="20dp"/> 26 </LinearLayout> 27 <LinearLayout 28 android:layout_width="match_parent" 29 android:layout_height="match_parent" 30 android:orientation="horizontal" 31 <!-- android:gravity="right" --> 32 android:layout_weight="1"> 33 <ImageView 34 android:layout_width="@dimen/x45" 35 android:layout_height="@dimen/y45" 36 android:layout_gravity="center_vertical" 37 android:layout_marginRight="@dimen/x60" 38 android:src="@mipmap/p_add"/> 39 </LinearLayout> 40 41 </LinearLayout>

上面就是我的布局文件,长下面这个鸟样,

我的目的是想把那个中间的加号放到右边去,不要问我为什么这么傻逼用了layout_weight 这也是被逼的没办法之后的一个尝试。网上说这样可以,然而并没有什么卵用,设置成 

android:layout_gravity="center_vertical|right"

这样都没有任何效果,我只是想把控件摆到右边去,多简单的一件事,直接margin_right不行么!!!Android布局什么鬼,特么气死我了。

后来又百度了一下,是需要在LinearLayout里面吧gravity设置为right这样才行,也就是我上面注释掉的那行。蛋疼,可能我的想法其实更适合用RelativeLayout吧。

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

Android输入法遮挡了输入框,使用android:fitsSystemWindows="true"后界面顶部出现白条

问题1、页面布局文件:<LinearLayoutxmlns:android"http://schemas.android.com/apk/res/android"android:id"@id/layoutorderdetail"android:layoutwidth"matchparent"android:layoutheigh

Spinner使用

1.在xml文件设立布局文件<Spinner    android:layout\_width"wrap\_content"    android:layout\_height"wrap\_content"    android:layout\_below"@id/b1"    andro

KVM调整cpu和内存

一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid

Android LinearLayout布局控件靠右 - HelloWorld