最外层布局.addOnLayoutChangeListener(new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View arg0, int arg1, int arg2, int arg3,
int arg4, int arg5, int arg6, int arg7, int arg8) {
// TODO Auto-generated method stub
if(EditText.hasFocus()){
/**
* 这里没有用handler,所以sroderScrollView不会滚动到最底部。只是滚动初始化高度。
* 全都滚动到底部万一scrollview太长会导致edittext滚出屏幕
* new Handler().post(new Runnable(
* public void run(){
* ScrollView.fullScroll(ScrollView.FOCUS_DOWN);
* }));
*/
ScrollView.fullScroll(ScrollView.FOCUS_DOWN);
EditText.requestFocus();
}
}
});
时间: 2024-11-05 14:57:38