选择文字后,然后关闭键盘,视图停留在屏幕的一半

时间:2019-07-05 13:49:31

标签: android

我的布局的根部有一个ScrollView,并且活动设置为在弹出键盘时调整大小。到目前为止,一切正常。键盘打开,视图缩小并开始滚动,键盘关闭,视图返回到覆盖屏幕。

当我在EditText中选择一些文本时,问题就开始了:屏幕顶部弹出一个空的操作栏(不确定是否相关),现在,当我按下(两次)以关闭操作栏时,键盘,视图不会向后展开。

这是在运行5.0.1的Samsung Galaxy S4,运行6.0.1的OnePlus One上发生的,我看到了类似于上下文菜单的弹出窗口,而不是操作栏,并且视图保持正常工作。

该活动是AppCompatActivity,我正在使用com.android.support:appcompat-v7:28.0.0com.android.support:support-v4:28.0.0

好吧,我确实怀疑操作栏与它有关,有时我可以看到它的内容在出现时瞬间闪烁。

活动上带有此FullscreenTheme

    <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:windowTranslucentNavigation">false</item>
        <item name="android:fitsSystemWindows">true</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="FullscreenTheme" parent="AppTheme">
        <item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
        <item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
    </style>

并执行以下操作:

    protected void onResume() {
        super.onResume();
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
    }

也许这有所帮助,但我看不到它将如何影响调整大小。

0 个答案:

没有答案