Android Programming Tutorials

(Romina) #1
No, Really Listening To Your Friends

We also need to create a layout for our rows. We have three pieces of


information to display: the screen name of the friend, the status message,


and the date the status was modified. Create Patchy/res/layout/row.xml


with the following layout to display all three of those pieces:


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="4px"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1"
android:gravity="center_vertical"
>
<TextView android:id="@+id/friend"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:textStyle="bold"
android:singleLine="true"
android:ellipsize="end"
/>
<TextView android:id="@+id/created_at"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:singleLine="true"
android:ellipsize="end"
/>
</LinearLayout>
<TextView android:id="@+id/status"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:singleLine="false"
/>
</LinearLayout>

Now we need to replicate a lot of the logic from LunchList to populate this


custom list in Patchy.


Add a TimelineEntry inner class to Patchy to hold a single timeline entry:


189
Free download pdf