0

如何创建像这张图片http://imgur.com/ShuZhbg的消耗性列表视图 ?如何创建这个屏幕?它包含三个可扩展节点(描述包含营养)并显示不同的屏幕我看到这个例子http://ranfeng0610.blog.163.com/blog/static/1857082842011727111359969/ 但它使用列表视图与所有使用相同的 UI 我想显示不同UI 与每个节点我将如何做到这一点?帮助我任何想法或示例????

                1、main.xml
                  <?xml version="1.0" encoding="utf-8"?>
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
   >
   <!-- 禁用系统自带图标android:groupIndicator="@null" -->
 <ExpandableListView
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:groupIndicator="@null"
 android:id="@+id/mExpandableListView"
 />
 </LinearLayout>

  2   、group.xml

 <?xml version="1.0" encoding="utf-8"?>
  <LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation = "horizontal"
    android:layout_width="fill_parent" 
 android:layout_height="fill_parent">
  <ImageView
android:layout_width = "25dip"
android:layout_height = "25dip"
android:layout_marginTop="10dip"
 android:id="@+id/mImageView"
/>
<TextView
  android:id = "@+id/group_tv"
 android:layout_width = "wrap_content"
 android:layout_height = "wrap_content"
  android:paddingLeft = "30px"
 android:paddingBottom = "10px"
  android:textSize = "26sp"/>
</LinearLayout>
 3、child.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation = "horizontal"
 android:layout_width="match_parent"
 android:layout_height="match_parent">
<ImageView
 android:layout_gravity = "center_vertical"
 android:id = "@+id/child_iv"
 android:layout_width = "70px"
 android:layout_height = "70px"
 android:paddingLeft = "30px"
 android:paddingTop = "2px"
 android:paddingBottom = "5px"
 android:src = "@drawable/icon"/>
 <TextView
 android:layout_gravity = "center_vertical"
 android:id = "@+id/child_tv"
 android:layout_width = "fill_parent"
 android:layout_height = "fill_parent"
  android:paddingLeft = "30px"
  android:paddingTop = "10px"
 android:paddingBottom = "5px"
 android:textSize = "30sp"/>
 </LinearLayout>
4

0 回答 0