Few days ago I have faced the issue, that I'm not able to draw the border around the group of views in Android 1.5, because it has no support for standart approach with shapes in drawable :))
<?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="wrap_content"
android:orientation="vertical"
android:background="#FF000000"
>
<include layout="@layout/tab_tracker_group_header"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="1px"
android:paddingRight="1px"
android:paddingTop="1px"
android:paddingBottom="1px">
<include layout="@layout/tab_tracker_group_item1"/>
<include layout="@layout/tab_tracker_group_item2"/>
<include layout="@layout/tab_tracker_group_item1"/>
<include layout="@layout/tab_tracker_group_item2"/>
<include layout="@layout/tab_tracker_group_item1"/>
<include layout="@layout/tab_tracker_group_item2"/>
<include layout="@layout/tab_tracker_group_item1"/>
</LinearLayout>
</LinearLayout>
The trick here is to create parent layout and set its background to any color you like (black in example), and add child layout with 1px padding from all sides! :))
Also, please note:
1. Be aware that if you will have a lot of nested layouts (actually near 5+), you will get stack overflow exception instead of your pretty layout on the screen :)
2. Android 1.5 emulator is very cute and fast!!!
3. Use include layout tags for easy grouping of repeating elements - extremelly useful!
Happy programming! (:
Best regards,
Yahor
0 comments:
Post a Comment