xml - Android App 50 percent width -
i trying build little android app , need 2 linearlayout
side side. (50/50)
how looks: http://i.stack.imgur.com/c9ycf.png
i try use: android:layout_width="0dp" android:layout_weight="1"
didn't work.
this xml:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/part"> <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="9pt" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:baselinealigned="true" android:background="#ff7f7f7f" android:id="@+id/head"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancesmall" android:text="123456789" android:id="@+id/textview" android:paddingstart="3pt" android:paddingleft="3pt" android:textcolor="#ffffffff" android:singleline="false" /> </linearlayout> <linearlayout android:id="@+id/left" android:orientation="vertical" android:layout_width="0dp" android:layout_weight="1" android:layout_height="fill_parent" android:layout_alignparentleft="true" android:layout_alignparentbottom="true" android:layout_below="@+id/head" android:background="#ffff0100" > </linearlayout> <linearlayout android:id="@+id/right" android:orientation="vertical" android:layout_width="0dp" android:layout_weight="1" android:layout_height="fill_parent" android:layout_alignparentbottom="true" android:layout_alignparentright="true" android:layout_below="@+id/head" android:background="#fffcff00" />
how should look: http://i.stack.imgur.com/tup01.png
have 1 more linearlayout
horizontal orientation below @+id/head
linearlayout. set width match_parent
. keep last 2 linearlayouts inside new linearlayout , have android:layout_weight=0.5
both. like:
<relativelayout> <linearlayout> </linearlayout> <linearlayout ... android:orientation:"horizontal"/> <linearlayout android:weight="0.5" android:width="0dp" ... /> </linearlayout> <linearlayout android:weight="0.5" android:width="0dp" ... /> </linearlayout> </linearlayout> </relativelayout>
Comments
Post a Comment