android - Two Buttons on top two on bottom -


i looking 4 buttons on screen. 2 on top , tow on bottom. code gives me top buttons way want it. when change layout_alignparenttop="true" layout_alignparentbottom="true" buttons stay on top. dont move bottom expected. ideas?

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/linearlayout02"      android:layout_height="wrap_content"      android:layout_width="fill_parent"      android:layout_alignparenttop="true"> <button      android:id="@+id/button02"      android:layout_width="wrap_content"      android:layout_height="wrap_content"      android:layout_weight="1" android:text="test"> </button> <button      android:id="@+id/button03"      android:layout_width="wrap_content"      android:layout_height="wrap_content"     android:layout_weight="1"      android:text="test"> </button> </linearlayout> 

so should create parent element <relativelayout> , in create 2 <linearlayouts> each contains 2 button. , align first layout top can use android:layout_alignparenttop="true" , align second bottom use android:layout_alignparentbottom="true"

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:background="#3b3b3b">      <linearlayout         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:orientation="horizontal"         android:padding="10dp"         android:gravity="center_horizontal"         android:layout_alignparenttop="true">          <button              android:id="@+id/loginbtn"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_margintop="40dp"             android:text="second"             />          <button              android:id="@+id/loginbtn"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_margintop="40dp"             android:text="second"/>      </linearlayout>      <linearlayout         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:orientation="horizontal"         android:padding="10dp"         android:gravity="center_horizontal"         android:layout_alignparentbottom="true"         >          <button              android:id="@+id/loginbtn"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_margintop="40dp"             android:text="second"             />          <button              android:id="@+id/loginbtn"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_margintop="40dp"             android:text="second"             />     </linearlayout> </relativelayout> 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -