Friday, 18 July 2014

Making 2 horizontal buttons fill the screen



Here is the xml



<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}" >

<Button
android:id="@+id/buttonGnc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="Güncelle" />

<ListView
android:id="@+id/listView1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_below="@+id/Doviz" >

</ListView>

**<Button
android:layout_toLefttOf="@+id/Doviz"
android:id="@+id/Altin"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_above="@+id/listView1"
android:layout_alignParentRight="true"
android:layout_weight="1"
android:text="Altın" />
<Button
android:id="@+id/Doviz"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/buttonGnc"
android:layout_weight="1"
android:text="Döviz" />
</RelativeLayout>**


Ok the buttons whict i want to fill the parent with are Doviz and Altin others are irrelevant.


I tried making width for both of them fill_parent hoping they might get half - half didn't work. I tried giving them width as "0dp" didnt work.


My question is how i can make them(buttons) get the width %50-%50.


No comments:

Post a Comment