0
我有一個列表視圖。如何動態創建視圖組?
我想添加頁腳。
所以我創建了一個頁腳XML
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="100px"
android:background="@drawable/background_news_list"
android:gravity="center" >
<ImageButton
android:id="@+id/btn_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:background="@drawable/btn_more_news" />
</LinearLayout>
我想擡高整個佈局爲主要Java,但我設法擡高按鈕僅
footer = getLayoutInflater().inflate(R.layout.testing, null, false);
btnmore = (ImageButton)footer.findViewById(R.id.btn_more);
ListView lv = (ListView) findViewById(android.R.id.list);
lv.addFooterView(footer);
我的名單是在這個XML
<LinearLayout
android:id="@+id/layout_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/layout_menu"
android:layout_below="@id/layout_title"
android:orientation="vertical" >
<ListView
android:id="@+android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
我如何創建一個視圖組來實現併成爲這樣?
footer = getLayoutInflater().inflate(R.layout.testing, parent, false);
因此,我可以使用我自己的線性佈局。
一樣,不起作用 –
footerview沒有使用頁腳的線性佈局xml –