1

ポジショニングに問題がありTextViewsます。現在、私のレイアウトは次のようになっています。

Text1: Text2
Text3: Text4

わかりましたが、Text22行以上の長さがある場合は次のようになります:

Text1: Text2:1
Text3: Text2:2/Text4

次のようなビューを取得するためにレイアウトを設定する方法がわかりません。

Text1: Text2:1
       Text2:2
Text3: Text4

誰かがその問題を解決するのを手伝ってくれますか?

XML コード:

(...)
//Text1:
<TextView 
    android:id="@+id/tv_author_label"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/tv_genre_label"
    android:layout_toRightOf="@+id/img_Cover"
    android:text="Author: "
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textStyle="bold" />

//Text2:
<TextView
    android:id="@+id/tv_author"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/tv_author_label"
    android:layout_alignBottom="@+id/tv_author_label"
    android:layout_toRightOf="@+id/tv_author_label"
    android:text="Anonymous Anonymous"
    android:textAppearance="?android:attr/textAppearanceMedium" />

//Text3:
<TextView
    android:id="@+id/tv_availability_label"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/tv_author_label"
    android:layout_toRightOf="@+id/img_Cover"
    android:
    android:textStyle="bold"
    android:text="Availability: "
    android:textAppearance="?android:attr/textAppearanceMedium" />

//Text4:
<TextView
    android:id="@+id/tv_availability"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/tv_availability_label"
    android:layout_alignBottom="@+id/tv_availability_label"
    android:layout_toRightOf="@+id/tv_availability_label"
    android:layout_alignParentLeft="@+id/tv_availability_label"
    android:layout_below="@+id/tv_author"
    android:text="b/d"
    android:textAppearance="?android:attr/textAppearanceMedium" />

(...)
4

2 に答える 2

0

このようなコードを再構築できます。

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

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

    <TextView
        android:id="@+id/tv1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

    <TextView
        android:id="@+id/tv2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="dfsdjfkd dsfsdf sdfsdf sdfsdfsd fjlsdjf sdj; j; jlksdfjl sdjflkdsjflsdk jkldsjf lsjldkfj sdl" />
</LinearLayout>

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

    <TextView
        android:id="@+id/tv3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

    <TextView
        android:id="@+id/tv4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />
</LinearLayout>

参考になれば幸いです!!

于 2013-05-25T14:42:03.333 に答える
0

水平方向の線形レイアウト内にテキスト ビューの行をカプセル化できます。

于 2013-05-25T14:43:57.653 に答える