这是个悲伤而又略带绝望的故事,发生在我和xml布局之间,他气死了我,我删了它。android
我说 靠右。布局
控件非不。code
全剧终。xml
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:background="@drawable/bg_personal_major_experience_item_shape" android:layout_marginTop="@dimen/y30" android:layout_marginLeft="@dimen/x30" android:layout_marginRight="@dimen/y30"> <LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/y122" android:orientation="horizontal"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:layout_weight="1"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="教育背景" android:textColor="@color/colorBlue" android:layout_gravity="center_vertical" android:layout_marginLeft="@dimen/x60" android:textSize="20dp"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" <!-- android:gravity="right" --> android:layout_weight="1"> <ImageView android:layout_width="@dimen/x45" android:layout_height="@dimen/y45" android:layout_gravity="center_vertical" android:layout_marginRight="@dimen/x60" android:src="@mipmap/p_add"/> </LinearLayout> </LinearLayout>
上面就是个人布局文件,长下面这个鸟样,ip
个人目的是想把那个中间的加号放到右边去,不要问我为何这么傻逼用了layout_weight 这也是被逼的没办法以后的一个尝试。网上说这样能够,然而并无什么卵用,设置成 it
android:layout_gravity="center_vertical|right"
这样都没有任何效果,我只是想把控件摆到右边去,多简单的一件事,直接margin_right不行么!!!Android布局什么鬼,特么气死我了。io
后来又百度了一下,是须要在LinearLayout里面吧gravity设置为right这样才行,也就是我上面注释掉的那行。蛋疼,可能个人想法其实更适合用RelativeLayout吧。class