のListViewを作成しようとしています TextView
要素、およびリストの各行を長方形で囲む必要があります。
リストが表示され、行(長方形)が親ではなくコンテンツと一致する場合に問題が発生します 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>
回答:
回答№1は0行の長方形の形状で、layout_widthを一致する親または塗りつぶす親として使用します