mercredi 13 mai 2015

Can we wrap children of ExpandableListView with a border

I have the following ExpandableListView, which contains group_item and child_items. I added margin to the child items so that I could all wrap children with a border.

enter image description here

I would like to know Can we wrap children of ExpandableListView with a border as below?

enter image description here

Code:

list_group.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="fill_parent"
android:layout_height="55dip"
android:background="@drawable/trip_group_border"
android:orientation="vertical">

<TextView
    android:id="@+id/textView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textSize="17dip"
    android:paddingTop="15dp"
    android:paddingBottom="15dp"
    android:paddingLeft="7dip"
    android:paddingRight="?android:attr/expandableListPreferredItemIndicatorRight"
    />

</LinearLayout>

list_item.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="@drawable/trip_item_outer_border"
android:orientation="vertical" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:background="@drawable/trip_item_border"
    android:orientation="horizontal"
    android:weightSum="2" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="left|center_vertical"
        android:layout_weight="1"
        android:clickable="false"
        android:paddingBottom="5dp"
        android:paddingLeft="5dp"
        android:paddingRight="10dp"
        android:paddingTop="5dp"
        android:textAlignment="gravity"
        android:textColor="@color/black2"
        android:textSize="17dip" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="left|center_vertical"
        android:layout_weight="1"
        android:paddingBottom="5dp"
        android:paddingLeft="5dp"
        android:paddingRight="5dp"
        android:paddingTop="5dp"
        android:textAlignment="gravity"
        android:textColor="@color/black2"
        android:textSize="17dip" />
</LinearLayout>

</LinearLayout>

Aucun commentaire:

Enregistrer un commentaire