开发者

ListActivity layout Custom

I'm trying to make a list where each row has a text at the top and bottom and another one image aligned right (like the image attached).

but I can not. Could anyone help me?

sample image:

http://www.freei开发者_运维问答magehosting.net/uploads/fb6e2055f5.png


There are plenty of tutorial and questions about it.

Just to mention a few from a google search:

  • http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/
  • http://developerlife.com/tutorials/?p=327
  • http://tech-droid.blogspot.com/2009/07/custom-listview-for-android.html

I didn't test it, but your row xml should be something like this:

<?xml version="1.0" encoding="utf-8"?>
  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <TextView android:id="@+id/green_title"
      android:textSize="25sp"
      android:textColor="#00FF00"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentLeft="true"
      android:text="Text1"/>

    <TextView android:id="@+id/sub_title"
      android:textSize="15sp"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_below="@id/green_title"
      android:text="Text2"/>

    <ImageView android:id="@+id/image"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:src="@drawable/image"
      android:layout_alignParentRight="true"
      android:layout_below="@id/green_title"/>
  </RelativeLayout>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜