1

I would like to build a listview for a discussion forum that looks like as a discussion in the iphone (i.e.: the handcent app). I saw some examples but no one uses the 9-patch.

Does anyone have some examples?

animuson
  • 53,861
  • 28
  • 137
  • 147
Giulio
  • 61
  • 2
  • 6

2 Answers2

1

check this? Why do 9-patch graphics size correctly in the emulator but not on a phone? this guy got an example of a speech bubble on 9 patch. you should try experimenting with the 9 patch tool it will surely deem to be useful next time

Community
  • 1
  • 1
Rejinderi
  • 11,694
  • 2
  • 31
  • 40
  • Hey, thank you I solve my problem with this guide: http://developer.android.com/guide/developing/tools/draw9patch.html – Giulio May 11 '11 at 17:46
0

Here my soulution: post_list_item_even.xml

<ImageView android:id="@+id/post_icon"
    android:gravity="center_horizontal|center_vertical"
    android:padding="15dip" android:layout_width="wrap_content"
    android:layout_height="fill_parent" android:layout_alignParentTop="true"
    android:layout_alignParentBottom="true" />

<TextView android:id="@+id/post_text"
    android:gravity="center_vertical" 
    android:layout_height="wrap_content" android:layout_width="fill_parent"
    android:layout_toRightOf="@id/post_icon" android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true" android:background="@drawable/forum_bubble_even" />

post_list_item_odd.xml

<ImageView android:id="@+id/post_icon"
    android:gravity="center_horizontal|center_vertical"
    android:padding="15dip" android:layout_width="wrap_content"
    android:layout_height="fill_parent" android:layout_alignParentRight="true"
    android:layout_alignParentBottom="true" />

<TextView android:id="@+id/post_text"
    android:gravity="center_vertical" 
    android:layout_height="wrap_content" android:layout_width="fill_parent"
    android:layout_toLeftOf="@id/post_icon" android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true" android:background="@drawable/forum_bubble_odd" />

Hope it will be useful!! :)

Giulio
  • 61
  • 2
  • 6