这是我的应用程序中的编辑表单, 在“Simpan Perubahan”按钮之后还剩下一个按钮。 如何使我的表单可滚动并使最后一个按钮可见和可点击?
我对布局了解不多。
代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:text="ID Objek"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/tv_obj_id"
android:editable="false"
android:singleLine="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="Nama Objek"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/tv_obj_nama"
android:editable="true"
android:singleLine="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="Detail Objek"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/tv_obj_det"
android:editable="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="Koordinat Objek"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="Longitude"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/tv_obj_long"
android:editable="true"
android:singleLine="true"
android:inputType="numberDecimal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="Latitude"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/tv_obj_lat"
android:editable="true"
android:singleLine="true"
android:inputType="numberDecimal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/btn_obj_submit"
android:text="Simpan Perubahan"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btn_obj_back"
android:text="Simpan Perubahan"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
我应该如何处理我的 xml 文件?
最佳答案
你的布局应该是这样的
<LinearLayout vertical>
<ScrollView>
<LinearLayout vertical>
... here are your fields ...
</LinearLayout>
</ScrollView>
<LinearLayout horizontal>
... here are your buttons ...
</LinearLayout>
</LinearLayout>
关于android - 如何使布局可滚动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6422150/