adjustPan not working with FLAG_LAYOUT_NO_LIMITS

我只是一个虾纸丫 提交于 2019-12-04 17:25:40

问题


My Requirement is a full transparent status bar with change color of the status bar in same activity dynamically.

For that, I added getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

and in style.xml

<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowTranslucentStatus">false</item>

So It's working fine but I need to adjust screen when soft keypad opens. So I tried android:windowSoftInputMode="adjustPan|adjustResize" but screen not resized or scrolled. Anyone can help me on same.


回答1:


Make transparent and change color dynamically like this dont set flag FLAG_LAYOUT_NO_LIMITS then check the screen when keypad is opened.

      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            window.setStatusBarColor(getResources()
                    .getColor(R.color.themeToolbarColor));
        }


来源:https://stackoverflow.com/questions/39269543/adjustpan-not-working-with-flag-layout-no-limits

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!