Android LinearLayout佈局控件靠右

這是個悲傷而又略帶絕望的故事,發生在我和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

相關文章
相關標籤/搜索