android - layout_weight doesn't take effect -
i'm trying split vertical space between views evenly using layout_weight
reason doesn't work. followed this answer , still views's spaces aren't effected that. doing wrong?
<linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <space android:layout_width="1dp" android:layout_height="0dp" android:layout_weight="1" > </space> <android.support.design.widget.textinputlayout android:layout_width="match_parent" android:layout_height="wrap_content"> <autocompletetextview android:background="@drawable/rounded_corners_white" android:id="@+id/email" android:paddingend="16dp" android:paddingstart="16dp" android:layout_marginright="16dp" android:layout_marginleft="16dp" android:layout_height="40dp" android:layout_width="match_parent" android:inputtype="textemailaddress" android:maxlines="1" android:singleline="true" /> </android.support.design.widget.textinputlayout> <space android:layout_width="1dp" android:layout_height="0dp" android:layout_weight="1" > </space> <android.support.design.widget.textinputlayout android:layout_width="match_parent" android:layout_height="wrap_content"> <edittext android:id="@+id/password" android:layout_width="match_parent" android:layout_marginright="16dp" android:layout_marginleft="16dp" android:paddingend="16dp" android:paddingstart="16dp" android:layout_height="40dp" android:background="@drawable/rounded_corners_white" android:imeactionid="@+id/login" android:imeactionlabel="@string/action_sign_in_short" android:imeoptions="actionunspecified" android:inputtype="textpassword" android:maxlines="1" android:singleline="true" /> </android.support.design.widget.textinputlayout> <space android:layout_width="1dp" android:layout_height="0dp" android:layout_weight="1" > </space> <view android:layout_margintop="30dp" android:layout_marginbottom="30dp" android:layout_marginright="15dp" android:layout_marginleft="15dp" android:layout_width="match_parent" android:layout_height="3dp" android:background="@drawable/rounded_corners_white" /> <space android:layout_width="1dp" android:layout_height="0dp" android:layout_weight="1" > </space> <button android:id="@+id/sign_in_button" android:layout_width="match_parent" android:layout_height="40dp" android:layout_marginright="16dp" android:layout_marginleft="16dp" style="?android:textappearancesmall"/> </linearlayout>
update: if image not shown (http://i.stack.imgur.com/mqalm.png) [
just add below line linearlayout:
android:weightsum="4"
Comments
Post a Comment