Creating a chat using Shapes or 9-patch image

I am trying to create a template for my chats in the Android application that I am currently working on. The end result should look something like this:

enter image description here

I tried it with Shapes, but I could not use multiple layers correctly. I also tried an image with 9 patches, but the creation of the 9 patch was before me. I had no idea how to use it, especially with the avatar, message header, and content placements.

Can anyone help?

My knowledge of the figures is quite limited, although I think I know enough to understand what you guys will say :)

+4
source share
1 answer

9 . : 9 .
.9.png, .png.
ViewGroup ( View), :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/row"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bubble_left"
    android:layout_margin="8dp"
    android:padding="8dp"
    >
    <!-- The User -->
    <TextView
        android:id="@+id/txtUser"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
    />
    <!-- The Date -->
    <TextView
        android:id="@+id/txtDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/txtUser"
    />
    <!-- The Message -->
    <TextView
        android:id="@+id/txt2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/txtDate"
    />
</RelativeLayout>

, ( ).

, ( ), Java-.

+6

All Articles