Android Relativelayout two buttons rightof one button -
i wondering how use relativelayout in order make tructure this:
three buttons, let's call them b , c; want put b , c 1 above other , both of them on right side of single block matching same width , height of (so we'll have b , c have half height of same width).
since can't post images yet here can find image of i'm looking for: http://img191.imageshack.us/img191/9765/stackg.jpg
the code wrote part one:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/black" android:paddingleft="16dp" android:paddingright="16dp" > <spinner android:id="@+id/a" android:layout_width="0dp" android:layout_height="96dp" android:layout_below="@id/another_block_that_fills_all_the_line" android:layout_alignparentleft="true" android:layout_toleftof="@+id/b" /> <spinner android:id="@id/b" android:layout_width="96dp" android:layout_height="48dp" android:layout_below="@id/another_block_that_fills_all_the_line" android:layout_alignparentright="true" /> <spinner android:id="@id/c" android:layout_width="96dp" android:layout_height="48dp" android:layout_below="@id/b" android:layout_alignparentright="true" /> </relativelayout>
the problem it's not going scale every screen because had set static sizes. tried lot of different solutions using possible combinations layout_align , changing wrap_content randomly still, can't fit them in way want them without using static sizes.
use linearlayout
layout_weight
. try layout
<linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <button android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1.0"/> <linearlayout android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1.0" android:orientation="vertical"> <button android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1.0"/> <button android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1.0"/> </linearlayout> </linearlayout>
Comments
Post a Comment