wpbloger
wpbloger

Reputation: 179

android share bubbles triangle right

Now I have left the layout of the message, that's the code:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:top="17dp" android:left="4dp">
        <rotate
            android:fromDegrees="-45"
            android:pivotX="0%"
            android:pivotY="0%"
            android:toDegrees="0" >
            <shape android:shape="rectangle" >
                <solid android:color="#fff3f3f3" />
            </shape>
        </rotate>
    </item>
    <item android:left="10dp">
        <shape android:shape="rectangle" >
            <solid android:color="#fff3f3f3" />
            <corners android:radius="3dp" />
        </shape>
    </item>
</layer-list>

How do I get the right part of the figure for the Messages? What it looks like in the screenshot

Upvotes: 0

Views: 484

Answers (1)

William Kinaan
William Kinaan

Reputation: 28819

Here you go a working code:

Change your activity's layout to:

<?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="#b46565">


    <LinearLayout
        android:id="@+id/r"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_centerInParent="true"
        android:background="@drawable/my_shape2"
        android:orientation="horizontal"></LinearLayout>

    <LinearLayout
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:layout_alignTop="@id/r"
        android:layout_marginLeft="-8dp"
        android:layout_marginTop="10dp"
        android:layout_toRightOf="@id/r"
        android:background="@drawable/my_shape3"></LinearLayout>
</RelativeLayout>

Create my_shape2.xml file inside drawable folder

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:left="10dp">
        <shape android:shape="rectangle">
            <solid android:color="#fff3f3f3" />
            <corners android:radius="3dp" />
        </shape>
    </item>
</selector>

Create my_shape3.xml file inside drawable folder

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <rotate android:fromDegrees="45" android:pivotX="0%" android:pivotY="0%" android:toDegrees="120">
            <shape android:shape="rectangle">
                <solid android:color="#fff3f3f3" />
            </shape>
        </rotate>
    </item>
</selector>

The result

enter image description here

Upvotes: 0

Related Questions