我有一个在运行时加载片段的活动。当我启动应用程序时,活动会加载一个带有 EditText 的片段。我将 ActionBarSherlock 与 splitActionBarWhenNarrow 一起使用,所以我有一个拆分栏(屏幕底部的操作栏)。当 EditText 获得焦点并加载软键盘时,它会位于拆分栏的顶部,将其隐藏。在操作栏上,我还使用 NAVIGATION_MODE_LIST 并使用下拉菜单加载另一个片段。当我加载另一个片段时,下部操作栏正确显示在软键盘顶部,即使我转到另一个片段,它仍然可以正常工作。我将添加一些屏幕截图以清除它:
第一个片段加载器,使用软键盘看不到拆分栏
使用操作栏导航加载第二个片段后
重新加载另一个片段,动作栏仍然可见
我尝试使用最少代码的测试项目来加载片段,并且行为是相同的,分割栏被软键盘隐藏。我怎样才能让它从一开始就显示拆分栏?
编辑: android:windowSoftInputMode="adjustResize" 不会改变这种行为
活动布局:
<it.bem.remailr.MyFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container"
android:orientation="horizontal"
android:background="@drawable/bg_no_repeat"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
片段布局:
<it.bem.remailr.MyRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<EditText
android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="top|left"
android:inputType="textMultiLine|textNoSuggestions"
android:windowSoftInputMode="adjustPan"
android:background="#00000000"
android:hint="@string/text_hint"
android:scrollHorizontally="false" >
</EditText>
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />