0

以下のようなレイアウトを作りたいです。

モデル レイアウト

そのために、コードを使用しています。テキストが小さい場合は問題ありtextWoundTypeDetailsませんが、テキストが大きい場合は、画像が画面から押し出され、テキストが全幅を埋めます。

<TextView
        android:id="@+id/textWoundType"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:padding="5dp"
        android:text="@string/wound_screener" />

<ImageView
        android:id="@+id/closebtn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="5dp"
        android:layout_alignParentRight="true"
        android:src="@drawable/buttonclose" />
<ImageView
        android:id="@+id/imgWoundType"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="5dp"
        android:layout_alignParentLeft="true"
        android:layout_toLeftOf="@+id/textWoundTypeDetails"
        android:layout_below="@id/textWoundType"
        android:src="@drawable/article_noimg" />

<TextView
        android:id="@+id/textWoundTypeDetails"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@id/textWoundType"
        android:padding="5dp"
        android:text="A wound caused by superficial damage to the skin, no deeper than the epidermis. It is less severe than a laceration, and bleeding, if present, is minimal." />

この問題を解決するには?

4

1 に答える 1

0

以下のコードを試してください。お役に立てば幸いです。

   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="2" >

        <TextView
            android:id="@+id/textWoundType"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_gravity="left"
            android:layout_weight="1"
            android:padding="5dp"
            android:text="SCRAPES" />

        <ImageView
            android:id="@+id/closebtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:layout_weight="1"
            android:padding="5dp"
            android:src="@drawable/ic_launcher" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="2" >

        <ImageView
            android:id="@+id/imgWoundType"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:padding="5dp"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/textWoundTypeDetails"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:layout_weight="1"
            android:padding="5dp"
            android:text="A wound caused by superficial damage to the skin, no deeper than the epidermis. It is less severe than a laceration, and bleeding, if present, is minimal." />
    </LinearLayout>

</LinearLayout>
于 2012-11-19T12:01:49.740 に答える