0

要素の ListView を作成しようとしていますが、リストのTextView各行を四角形で囲む必要があります。

問題は、リストが表示され、行 (Rectangles) が親の代わりにコンテンツと一致する場合に発生しますListView。私はこのようなものになります:

-------
.hello.
-------------
.How are you.
-------------

そして、私はこのようなものが欲しい:

-------------
.hello      .
-------------
.How are you.
-------------

ここに私の行要素 xml があります:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" 
    android:background="@layout/popup_lonely_row">

    <TextView
        android:id="@+id/promo_row_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="2dp"
        android:text="Lorem ipsum dolorem sit amet"
        android:textColor="@color/dark_gray_options" />
</LinearLayout>

行の長方形の形状 xml は次のとおりです。

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="5dp"
    android:shape="rectangle" >

    <solid android:color="#FFFFFF" />

    <stroke
        android:width="1dp"
        android:color="@color/blue_alert_stroke" />

</shape>
4

1 に答える 1

0

行の長方形の形状で、一致する親または塗りつぶしの親としてlayout_widthを使用します

于 2013-09-20T14:31:23.810 に答える