在android中单击键盘中的下一个按钮时自动滚动edittext

时间:2012-12-17 10:32:31

标签: android android-layout scrollbar scrollview

edittexts中有10 scrollview。而第一个edittext聚焦它显示如下图像。

enter image description here

点击下一步时,它显示如下。enter image description here

但我需要edittext自动滚动,如下图所示 enter image description here

请帮我解决这个问题。

2 个答案:

答案 0 :(得分:4)

android:windowSoftInputMode =“adjustPan”添加到 AndroidManifest.xml 中的活动代码。 它会相应地自动调整屏幕布局的滚动,不会打扰UI。试试吧。!

答案 1 :(得分:2)

这个对我有用。 将所有edittext和按钮放在scrollview中并编写此代码

ScrollView scrollView = (ScrollView)findViewById(R.id.scrollView);
                scrollView.fullScroll(ScrollView.FOCUS_DOWN);
                findViewById(R.id.edittext).requestFocus();