在编辑文本获得焦点后出现软键盘时,我正在尝试调整布局.现在,如果我有很多编辑文本并且键盘出现,则隐藏最后一个编辑文本,我无法向上滚动.
这就是我的布局构建方式:
模板:
<LinearLayout> <LinearLayout> // header 1 </LinearLayout> <LinearLayout> // header 1 </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" android:orientation="vertical"> // where I inflate view_1 </LinearLayout> <LinearLayout> // footer </LinearLayout> </LinearLayout>
查看(view_1):
<ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:focusable="true" android:focusableInTouchMode="true"> <LinearLayout> // ... </LinearLayout> <LinearLayout> // ... </LinearLayout> <LinearLayout> <TextView/> <EditText/> <TextView/> <EditText/> <TextView/> <EditText/> <TextView/> <EditText/> </LinearLayout> </LinearLayout> </ScrollView>
我已经尝试了android的各种组合:windowSoftInputMode(在manifest.xml上并以编程方式).我试图在滚动视图上设置android:isScrollContainer =“false”,但没有.
我也尝试了这个answer,在我的滚动视图中放置了一个GlobalLayoutListener,但是当键盘出现时没有调用onGlobalLayout.并且isKeyboardShown总是错误的.