我正在開發一個項目,我需要動態地添加TextView
和Spinner
以及通過該程序。我能夠從我的程序成功動態地添加這兩件事。如何修復Android中Button的位置
下面是我用於此的XML佈局。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
android:layout_width="100px"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:gravity="center_vertical|center_horizontal"
android:text="Save" />
</LinearLayout>
</ScrollView>
Problem Statement:-
因此,我希望是 - 所有TextView
和Spinner
應該得到所示,首先然後在最後Button
應該得到什麼所示。
但是,當前發生了什麼Save Button
顯示在頂部,然後所有其他TextView and Spinner
得到顯示。
我怎樣才能確定,該按鈕來自屏幕的底部。
下面是你可以找出問題的截圖。我想在屏幕底部顯示保存按鈕。
我試過這個,但在這種情況下。按鈕的大小隻是屏幕的寬度。我想讓Button完全顯示,因爲它在問題中的圖像中顯示。任何想法如何使這項工作? – ferhan 2013-03-24 23:52:24
你需要一個佈局。我編輯了我的答案並添加了示例代碼以將按鈕添加到佈局。 – 2013-03-25 09:35:56