カスタムリストにフッターを作成しようとしていますが、それでもうまくいきません。私の目的は、リストの最後にボタンを追加することです。私はこれを試しました:
adapter = new GeneralRssAdapter(this,R.layout.titlesrss, data);
LayoutInflater inflater = getLayoutInflater();
lv.addFooterView( inflater.inflate( R.layout.footer_layout, null ), null, false);
lv.setAdapter(adapter);
しかし、それでもフッターを見ることができません。これが私のxmlです:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/linearLa"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/iconremove"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_margin="5dip"
android:scaleType="centerCrop"
android:src="@drawable/delete"
android:visibility="gone" />
<ImageView
android:id="@+id/iconfav"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_margin="5dip"
android:scaleType="centerCrop"
android:src="@drawable/rss" />
<TextView
android:id="@+id/textView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:layout_margin="5dip"
android:layout_weight="1"
android:textSize="20dip" />
</LinearLayout>
<ListView android:id="@+id/ListView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
およびフッター:
<?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="vertical" >
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.20"
android:src="@drawable/tutorialrss"
/>
</LinearLayout>
あなたが私を助けてくれることを願っています:)