Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adjustPan not working with FLAG_LAYOUT_NO_LIMITS

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.

like image 929
Sanjay Kakadiya Avatar asked Sep 01 '16 10:09

Sanjay Kakadiya


1 Answers

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));
        }
like image 140
Sohail Zahid Avatar answered Nov 15 '22 18:11

Sohail Zahid