问题描述
我的要求"是一个完全透明的状态栏,状态栏的颜色在同一activity
中动态更改.
My Requirement is a full transparent status bar with change color of the status bar in same activity
dynamically.
为此,我添加了getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
和style.xml
and in style.xml
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowTranslucentStatus">false</item>
所以它工作正常,但是当软键盘打开时我需要调整屏幕.所以我尝试了android:windowSoftInputMode="adjustPan|adjustResize"
,但是屏幕没有调整大小或滚动.任何人都可以帮助我.
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.
推荐答案
使透明并动态更改颜色,例如不要设置标志FLAG_LAYOUT_NO_LIMITS
,然后在打开键盘时检查屏幕.
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));
}
这篇关于AdjustPan无法与FLAG_LAYOUT_NO_LIMITS一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!