我有一個很長的名單與搜索選項。我想要列表頂部和底部的按鈕「搜索」。兩個按鈕都具有相同的功能。我認爲只需在xml佈局中複製並超過第一個按鈕,但最後的按鈕沒有功能。如何在不在活動中添加一堆額外代碼的情況下使其工作?是否有可能在同一個佈局中擁有2個具有相同功能的按鈕?
<ScrollView
android:layout_width= "fill_parent"
android:layout_height= "fill_parent" >
<LinearLayout
android:id="@+id/LinearLayout02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/save_search_options"
android:text="Search" android:textSize="25dip"></Button>
<!--search options in between-->
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/save_search_options"
android:text="Search" android:textSize="25dip"></Button>
</LinearLayout>
</ScrollView>