0

リストビューのアイテムのレイアウトとしてこれがあります。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/msgbox_self_default" >

    <RelativeLayout
        android:id="@+id/layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:paddingLeft="7dip" >

        <ImageView android:id="@+id/pending" android:layout_height="fill_parent"
            android:layout_width="wrap_content" android:layout_marginLeft="2dip"
            android:src="@drawable/ic_sms_mms_pending" 
            android:visibility="gone"
             />
        <TextView           
            android:id="@+id/body"
            android:text="@+id/body"
            android:singleLine="false"
            android:paddingLeft="@dimen/message_item_text_padding_left_right"
            android:paddingRight="@dimen/message_item_text_padding_left_right"
            android:paddingTop="@dimen/message_item_text_padding_top"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:linksClickable="false"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="#ff000000"
            android:textSize="16sp"
            android:layout_alignParentRight="true" />



        <RelativeLayout
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_below="@id/body"
            android:id="@+id/picture_layout"
            android:orientation="vertical"

            >



        <ImageView android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:id="@+id/picture"
            android:visibility="gone"
            android:maxWidth="178dip" android:maxHeight="178dip"
            android:layout_alignParentRight="true"
            android:adjustViewBounds="true" android:background="@android:drawable/picture_frame"
            android:layout_centerHorizontal="true"/>
        </RelativeLayout>

        <TextView 
            android:paddingRight="@dimen/message_item_text_padding_left_right"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/picture_layout"
            android:paddingLeft="3dip"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:id="@+id/date"
            android:text="@+id/date" 
            android:singleLine="true"
            android:layout_alignParentRight="true" />



</RelativeLayout>

右側にバブルが欲しいのですが。これはメッセージバブルのレイアウトです。iPhoneの会話のように右側に配置しようとしています。左側ではなく右側に配置することに関して考えられるすべてのことを試しました。誰かが私のレイアウトに何か問題があると思いますか?助けてください!ありがとう

** 編集 **

この写真で狙っているのは緑色の泡です

http://getandroidstuff.com/wp-content/uploads/2010/12/GO-SMS-Android.jpg

*レイアウトの変更*

これは今のところ私が持っているものです..もうアイデア?

例

灰色の泡を右側を除いて白い泡のように見せたいです。

4

1 に答える 1

0

コードをふるいにかけるつもりはありませんが、基本的には、メッセージごとにこのようなものが必要です

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="put the right amount of padding in">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="make this your background, make sure to add padding in so that the text view is in the right place, look at 9 patches"
        android:layout_alignParentRight="true"/><!-- Or make this left -->

</RelativeLayout>

物事を過度に複雑にしないでください。9 パッチでテキスト ビューを使用するだけで、必要なことが行われます。

9 パッチを水平に入れ替えるだけで、逆になります。

于 2012-07-20T00:08:49.733 に答える