Android 如何获得储蓄和;像联系人中的取消按钮一样?
如果在“联系人”中编辑Android 如何获得储蓄和;像联系人中的取消按钮一样?,android,android-layout,Android,Android Layout,如果在“联系人”中编辑 “保存和取消”按钮始终位于顶部,并位于 虚拟键盘 表单元素是可滚动的 我想达到同样的行为。我有很长的表单要输入,我想让用户随时保存/取消 请提供帮助。线性布局中的每件东西都适合键盘上方,因此,请设计如下布局: <LinearLayout weightSum="X"> <ScrollView ayout_weight="y" > .... ..... </ScrollView> <Layout
- “保存和取消”按钮始终位于顶部,并位于 虚拟键盘
- 表单元素是可滚动的
请提供帮助。线性布局中的每件东西都适合键盘上方,因此,请设计如下布局:
<LinearLayout weightSum="X">
<ScrollView ayout_weight="y" >
....
.....
</ScrollView>
<Layout layout_wieght="z">
<btn save /> <btn cancel />
</layout>
<linearLayout>
....
.....
线性布局中的每件东西都适合键盘上方,因此,设计如下布局:
<LinearLayout weightSum="X">
<ScrollView ayout_weight="y" >
....
.....
</ScrollView>
<Layout layout_wieght="z">
<btn save /> <btn cancel />
</layout>
<linearLayout>
....
.....
您可以通过在布局中添加页脚视图来完成此操作。示例:
我使用此布局实现了同样的效果:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/linearLayout1"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:background="#ffffff">
<RelativeLayout
android:layout_width="fill_parent" android:layout_height="50dp">
<Button "></Button>
</RelativeLayout>
<ScrollView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1">
<LinearLayout android:id="@+id/linearLayout1"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:background="#ffffff">
<RelativeLayout android:gravity="bottom"
android:paddingTop="40dp" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:background="#ffffff"
android:paddingBottom="55dp">
<Button ></Button>
<Button ></Button>
<Button></Button>
<Button></Button>
</RelativeLayout>
</LinearLayout>
</ScrollView>
<!--for bottom bar -->
<RelativeLayout android:layout_height="50dp"
android:gravity="center" android:layout_width="match_parent"
android:id="@+id/linearLayout2" android:background="#ffffff">
<Button ></Button>
<Button ></Button>
<Button ></Button>
</RelativeLayout>
</LinearLayout>
可以通过在布局中添加页脚视图来完成此操作。示例:
我使用此布局实现了同样的效果:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/linearLayout1"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:background="#ffffff">
<RelativeLayout
android:layout_width="fill_parent" android:layout_height="50dp">
<Button "></Button>
</RelativeLayout>
<ScrollView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1">
<LinearLayout android:id="@+id/linearLayout1"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:background="#ffffff">
<RelativeLayout android:gravity="bottom"
android:paddingTop="40dp" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:background="#ffffff"
android:paddingBottom="55dp">
<Button ></Button>
<Button ></Button>
<Button></Button>
<Button></Button>
</RelativeLayout>
</LinearLayout>
</ScrollView>
<!--for bottom bar -->
<RelativeLayout android:layout_height="50dp"
android:gravity="center" android:layout_width="match_parent"
android:id="@+id/linearLayout2" android:background="#ffffff">
<Button ></Button>
<Button ></Button>
<Button ></Button>
</RelativeLayout>
</LinearLayout>
试试下面的代码,你需要的是里面的主布局
1) scrollview,在scroll view中添加一个包含多个视图的布局
2) 另一个布局,内部有两个按钮用于“保存和取消”。并添加样式作为按钮栏。
别忘了在scrollview中添加权重=1
试试下面的布局,你会得到你想要的
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scrollbars="horizontal|vertical" >
</ScrollView>
//在上面的滚动视图中,添加布局和其他视图
//下面的LAYU是您想要的按钮栏
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@android:style/ButtonBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="@+id/browseAddBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:text="Add" />
<Button
android:id="@+id/browseViewBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:text="Back" />
<Button
android:id="@+id/browseReturnBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Save" />
</LinearLayout>
试试下面的代码,你需要的是里面的主布局
1) scrollview,在scroll view中添加一个包含多个视图的布局
2) 另一个布局,内部有两个按钮用于“保存和取消”。并添加样式作为按钮栏。
别忘了在scrollview中添加权重=1
试试下面的布局,你会得到你想要的
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scrollbars="horizontal|vertical" >
</ScrollView>
//在上面的滚动视图中,添加布局和其他视图
//下面的LAYU是您想要的按钮栏
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@android:style/ButtonBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="@+id/browseAddBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:text="Add" />
<Button
android:id="@+id/browseViewBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:text="Back" />
<Button
android:id="@+id/browseReturnBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Save" />
</LinearLayout>
检查我的答案,你会完全得到你想要的..检查我的答案,你会完全得到你想要的。。