を使用して簡単なチャットバブルを実装しようとしていConstraintLayoutます。これは私が達成しようとしていることです:
ただし、wrap_content制約では正しく機能しないようです。マージンを尊重しますが、使用可能なスペースを適切に計算しません。これが私のレイアウトです:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout   xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <TextView
        android:id="@+id/chat_message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="16dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintHorizontal_bias="0"
        tools:background="@drawable/chat_message_bubble"
        tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris sodales accumsan tortor at bibendum."
        android:layout_marginStart="64dp"
        android:layout_marginLeft="64dp"
        android:layout_marginEnd="32dp"
        android:layout_marginRight="32dp"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="8dp" />
</android.support.constraint.ConstraintLayout>
これは次のようにレンダリングされます。
使用していcom.android.support.constraint:constraint-layout:1.0.0-beta4ます。
私は何か間違ったことをしていますか?それはバグですか、それとも単なる直感的でない動作ですか?を使用して適切な動作を実現できますかConstraintLayout(他のレイアウトを使用できることがわかっているので、ConstrainLayout具体的に質問します)。
tools:background="@drawable/chat_message_bubble"ます。:それはあなたが描画可能なフォルダにchat_message_bubble.xmlファイルを作成する必要があり、このコードを追加実装するには  <shape xmlns:android="http://schemas.android.com/apk/res/android">     <solid android:color="#FB4382"/>     <corners android:radius="10dip"/> </shape>
                




