我正在开发一个项目,我需要动态地添加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