Balloon chat application issues
I am doing a simple chat application and I want to show balloons similar to the iphone
's sms app.
So I am doing an Activity
with a ListView
with a certain layout.
This are my layouts:
/* Activity Layout */
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView android:id="@+id/chat_log"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stackFromBottom="true"
android:layout_marginTop="50dp"
android:transcriptMode="alwaysScroll"
android:layout_weight="1"
android:cacheColorHint="#00000000"
android:clickable="false"
/>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<EditText android:id="@+id/chat_input_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
androi开发者_Go百科d:layout_gravity="bottom"
/>
<Button android:id="@+id/chat_send_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/chat_send_button"
/>
</LinearLayout>
</LinearLayout>
Other:
/* Row Layout */
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/userprofile_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/chat_ballon_left" >
<TextView
android:id="@+id/chat_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="2dp"
android:text="haasdasdasdasdasdasdasdoo" />
</FrameLayout>
Here's the result.
My issues:
- The gray line which I would like to remove.
- Text is not using the whole space.
- Somehow even thought I've added
android:clickable="false"
the balloons are clickable.
The FrameLayout
is unnecessary, so use the TextView as a root element (with the chat_ballon_left background of course). Set the width to match_parent
so that the text takes the whole space.
BTW nice baloons, don't forget to have hdpi versions too :)
精彩评论