Android Programming Tutorials

(Romina) #1
Now Your Friends Seem Animated

menu...though we will need to do a little work to toggle the menu item


from "show" to "hide" mode and back again.


First, modify Patchy/res/layout/main.xml to replace our TableLayout with


some LinearLayout containers:


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout android:id="@+id/status_row"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView android:text="Status:"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<EditText android:id="@+id/status"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="false"
android:gravity="top"
android:lines="5"
android:scrollHorizontally="false"
android:maxLines="5"
android:maxWidth="200sp"
/>
<Button android:id="@+id/send"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Send"
/>
</LinearLayout>
<ListView android:id="@+id/timeline"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>

Partially, we did this because we really were not using much of the


TableLayout functionality anymore. More importantly, though, we need to


isolate our collection of widgets we want to animate into a single container



  • in this case, the innermost nested LinearLayout.


Next, add a statusRow View data member to Patchy:


264
Free download pdf