要素の 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>