android - Want to display 2 buttons vertically on top of each other, starting from the centre of the screen - only one button displays -
this first time using xml , working android noob. want have 2 buttons; sign in
, create account
, sign in
@ centre of screen , create account
directly beneath it.
what have create account
button , it's @ top of screen not centre. reason, sign in
doesn't appear anywhere. can take @ xml doc , see if can spot why happening?
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="match_parent" android:padding="25dp" android:layout_height="match_parent"> <button android:id="@+id/bsignin" android:text="signin" android:layout_centerhorizontal="true" android:layout_width="match_parent" android:layout_height="wrap_content" /> <button android:id="@+id/bcreateaccount" android:text="create account" android:layout_centerhorizontal="true" android:layout_width="match_parent" android:layout_height="wrap_content" /> </relativelayout>
oh , main activity (if has relevance). highly appreciate help!
use this:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:padding="25dp" android:layout_height="match_parent"> <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true"> <button android:id="@+id/bsignin" android:text="signin" android:layout_centerhorizontal="true" android:layout_width="match_parent" android:layout_height="wrap_content" /> <button android:id="@+id/bcreateaccount" android:text="create account" android:layout_centerhorizontal="true" android:layout_below="@+id/bsignin" android:layout_width="match_parent" android:layout_height="wrap_content" /> </relativelayout> </relativelayout>
Comments
Post a Comment