我在線性佈局中使用listview,我需要以編程方式添加按鈕。我嘗試了幾次tutiorials,沒有人足夠了,只是它沒有工作。你知道一些解決方案嗎?Android - 以編程方式將按鈕添加到ListView
編輯:我只是想要一個按鈕以編程方式添加和我的列表視圖(在列表視圖中沒有按鈕)。我無法以編程方式在我的活動中添加按鈕。
編輯:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/uss"
/>
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/list"
android:focusable="false"
android:focusableInTouchMode="false"
/>
凡在你的ListView做的添加按鈕,將其你需要添加按鈕?你需要爲ListView的每一行添加一個按鈕嗎?你的佈局xml也會有幫助。 – SBerg413
您是否需要將按鈕放在每個ListView的行中? – SBerg413
不,一個按鈕,然後是列表視圖 – Waypoint