Créez votre mise en page de bulles comme ce
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="16dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello"
android:padding="16dp"
android:background="@drawable/rounded_rect"/>
<ImageView
android:layout_marginTop="-1.5dp"
android:layout_width="8dp"
android:layout_height="16dp"
android:layout_gravity="start"
android:background="@drawable/corner"
/>
</LinearLayout>
fichiers Drawable
de rounded_rect.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#888" />
<corners
android:bottomRightRadius="8dp"
android:topLeftRadius="8dp"
android:topRightRadius="8dp"/>
</shape>
corner.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:fromDegrees="45"
android:pivotX="135%"
android:pivotY="15%"
android:toDegrees="45"
>
<shape android:shape="rectangle">
<solid android:color="#888"/>
</shape>
</rotate>
</item>
</layer-list>
Cette disposition va évoluer avec le texte que vous ajoutez à la TextView
EDIT
Je viens maintenant remarqué que la flèche de votre exigence devrait pointer vers la gauche. Pour obtenir ce faire quelques petits changements à votre mise en page de la bulle
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:orientation="horizontal">
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="bottom"
android:background="@drawable/corner2"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello"
android:padding="16dp"
android:background="@drawable/rounded_rect"/>
</LinearLayout>
corner2.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:fromDegrees="-45"
android:pivotX="135%"
android:pivotY="15%"
android:toDegrees="45"
>
<shape android:shape="rectangle">
<solid android:color="#888"/>
</shape>
</rotate>
</item>
</layer-list>
SORTIE
Vous avez probablement utiliser un '9- image de patch' pour ce –
Je ne sais pas ce qui est 9-patch, mais j'ai besoin tha t échelle de mise en page avec des lignes de texte. – user2983041
@ user2983041 J'ai posté une solution. Faites-moi savoir si cela ne fonctionne pas –