Scorpion
Scorpion

Reputation: 6901

9 patch not working

I have created 2 9 patch images, from them 1 is working perfect and 1 is not working. Tried to create it more than 10 times but everything failed. Don't know the reason and that is why in need of some help from community.

This is working perfect

Not working

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent" >

    <RelativeLayout
        android:id="@+id/rlContent"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@id/imgPhoto"
        android:layout_marginBottom="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="10dp"
        android:layout_toRightOf="@id/imgPhoto"
        android:background="@drawable/bubble"
        android:visibility="visible" >

        <TextView
            android:id="@+id/txtMessageDate"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Yesterday 4:25 PM"
            android:textColor="@android:color/black"
            android:textSize="12sp" />

        <TextView
            android:id="@+id/txtMessageSnippet"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/txtMessageDate"
            android:layout_marginTop="5dp"
            android:text="How are you?"
            android:textColor="@android:color/black"
            android:textSize="14sp" />
    </RelativeLayout>

// This is not workin - the light blue one

    <RelativeLayout
        android:id="@+id/rlContentOwner"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@id/imgPhotoOwner"
        android:layout_below="@id/rlContent"
        android:layout_marginBottom="10dp"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp"
        android:layout_toLeftOf="@id/imgPhotoOwner"
        android:background="@drawable/new_right_side_bubble"
        android:padding="0dp"
        android:visibility="visible" >

        <TextView
            android:id="@+id/txtMessageDateOwner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="yesterday 4:37 PM"
            android:textColor="@android:color/black"
            android:textSize="12sp" />

        <TextView
            android:id="@+id/txtMessageOwner"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/txtMessageDateOwner"
            android:layout_marginTop="5dp"
            android:text="I am fine"
            android:textColor="@android:color/black"
            android:textSize="14sp" />
    </RelativeLayout>

</RelativeLayout>

Upvotes: 1

Views: 236

Answers (1)

Phant&#244;maxx
Phant&#244;maxx

Reputation: 38098

You don't need such big 9 patches, since they will be stretched.
I redesigned them both like this:

speech_left.9.png enter image description here and speech_rite.9.png enter image description here

This is the result I got (I'm only showing the azure one):

enter image description here

Upvotes: 1

Related Questions