android - How to position a login box centered on application start? -
i new android , trying build login box, , experience troubles. created 2 textes (username, password) , 2 text-boxes next them, style login box area.
but unfortunately elements jump , down in correlation upper , lower bars, shown when user touches screen.
how can realize centered login box?
link: maximize image
here code:
<framelayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <linearlayout android:id="@+id/fullscreen_content_controls" style="?buttonbarstyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom|center_horizontal" android:background="@color/black_overlay" android:orientation="horizontal" tools:ignore="uselessparent"> <button android:id="@+id/dummy_button" style="?buttonbarbuttonstyle" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/login_button" /> </linearlayout> <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center_vertical|center_horizontal"> <tablelayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:baselinealigned="false" android:layout_alignparenttop="false" android:layout_alignparentleft="false" android:layout_alignparentbottom="false" android:layout_centerinparent="true"> <tablerow android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/login_username" android:id="@+id/textview" /> <edittext android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/edittext" android:layout_column="1" /> </tablerow> <tablerow android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/login_password" android:id="@+id/textview2" android:layout_column="0" /> <edittext android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/edittext2" android:layout_column="1" /> </tablerow> </tablelayout> </relativelayout> </framelayout>
there no need of table layout done relative , linearlayout. http://www.androidhive.info/2011/10/android-login-and-registration-screen-design/
Comments
Post a Comment