android - How to implement this layout? -
i divide current view 4 areas (not divide screen 4, divide view) following:
i have following sized layout view:
that's horizontally divided half of view each. vertically, upper area has 1/3 view height , lower 2 areas holds 2/3 view height.
i successfully divided view 4 equal sized areas by:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <linearlayout android:id="@+id/top_area" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:orientation="horizontal" > <linearlayout android:id="@+id/top_left_area" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/content_blue_bg" > <textview android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="top left"/> </linearlayout> <linearlayout android:id="@+id/top_right_area" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/content_blue_bg" > <textview android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="top right"/> </linearlayout> </linearlayout> <linearlayout android:id="@+id/bottom_area" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:orientation="horizontal" > <linearlayout android:id="@+id/bottom_left_area" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" > <textview android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="bottom left"/> </linearlayout> <linearlayout android:id="@+id/bottom_right_area" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/content_blue_bg" > <textview android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="bottom right"/> </linearlayout> </linearlayout> </linearlayout>
but how can have 1/3 view height uper areas , 2/3 view height lower areas?
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <linearlayout android:id="@+id/top_area" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:orientation="horizontal" > <linearlayout android:id="@+id/top_left_area" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/content_blue_bg" > <textview android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="top left"/> </linearlayout> <linearlayout android:id="@+id/top_right_area" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/content_blue_bg" > <textview android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="top right"/> </linearlayout> </linearlayout> <linearlayout android:id="@+id/bottom_area" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="2" android:orientation="horizontal" > <linearlayout android:id="@+id/bottom_left_area" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" > <textview android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="bottom left"/> </linearlayout> <linearlayout android:id="@+id/bottom_right_area" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/content_blue_bg" > <textview android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="bottom right"/> </linearlayout> </linearlayout>
all missing setting bottom layout 70% , top layout 30%
this had been posted on twitter http://blog.stylingandroid.com/archives/297 :-)
Comments
Post a Comment