チャットルーム用の吹き出しを作成しようとしています。各吹き出しには、添付のxmlレイアウトがあります。
textViewをwrap_contentに、吹き出しimageViewをmatch_parentに、frame_layoutをwrap_contentに設定することで、これを実現しています。テキストの背後にあるspeech_bubble画像 が、バブル内 のテキストの量に応じて拡大縮小されるようにします。
textViewの幅を親に一致するように設定し、高さをwrap_contentに設定しました。何らかの理由で、Ice Cream Sandwich(Android 4.1)で必要とされるように完全に機能します。ただし、Gingerbreadでは、テキストがバブル内にきちんと収まるように、内側のimageView吹き出しはmatch_parentにスケーリングされません。ジンジャーブレッドでは、テキストに関係なく、内側のimageViewは常に同じサイズのままであり、テキストはバブルの外側にオーバーフローします。frameLayoutがwrap_contentに展開されても、imageViewは想定どおりにmatch_parentではありません。
なぜこれが起こっているのかについてのアイデアはありますか?xmlを介して設定できる別のパラメーター、またはこれを修正するためにプログラムで呼び出すことができるメソッドはありますか?
ありがとう!
ICSでの正しい動作:
GingerBreadの不正な動作:GingerBreadの 不正な動作
XMLレイアウト:
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/speech_bubble_framelayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/color_transparent"
android:layout_toRightOf="@id/message_user_imageView">
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/message_background_imageview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:scaleType="fitXY"
android:layout_centerInParent="true"
android:textColor="@color/color_brown_mud"
android:background="@drawable/chat_bubble_flipped"
/>
<TextView
android:id="@+id/message_textView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:maxEms="10"
android:background="@color/color_transparent"
android:textColor="@color/color_brown_uiDesign_pallete"
android:textSize="15sp"
android:textStyle="bold"
android:gravity="center_horizontal"
android:text="Message"
android:padding="5dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="20dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
/>
</FrameLayout>
</merge>