0

ここに画像の説明を入力TextView複数行の右を配置するとしTextViewます。

以下のコードを確認してください。

<RelativeLayout
    android:id="@+id/rltest"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/rlanswer"
    android:layout_marginLeft="@dimen/grdiviewspacing"
    android:layout_marginRight="@dimen/grdiviewspacing"
    android:background="@android:color/transparent" >

    <TextView
        android:id="@+id/lblanswer2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dip"
        android:ellipsize="end"
        android:lines="1"
        android:text="@string/strbookmarkmessage"
        android:textColor="@color/black"
        android:textSize="@dimen/listviewlocationsize"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/btnyesiwillcollectitby"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dip"
        android:layout_toRightOf="@id/lblanswer2"
        android:autoLink="all"
        android:linksClickable="true"
        android:text="@string/stryesiwillcollectitby"
        android:textColor="@color/linkcolor"
        android:textSize="@dimen/listviewlocationsize" />
</RelativeLayout>

上記のコードで問題を試してみましたが、2番目が表示されませんTextView。試してみるとlayout_below、2番目のテキストビューが表示されます。誰でも私を助けてください..私はこのようなものが欲しいです-テキストビューを読むための青いテキストビューテキスト。

4

2 に答える 2

1

LinearLayout代わりに使用して両方にRelativeLayout与えると、必要な結果が得られます。layout_weight=1TextView

于 2013-10-10T13:14:46.823 に答える
0

を使用し続けたい場合はRelativeLayout、「lblanswer2」の幅を (wrap_content ではなく) dip で設定する必要がありますTextView。そうしないと、テキストが長い場合、常に場所全体が使用されます。

a を使用するRelativeLayout必要がない場合は、pratik の回答に従って a を実装できますLinearLayout。このようにして、2TextViewsは幅を均等に共有します。

于 2013-10-10T14:47:38.900 に答える