-1

I want my layout to start below the status bar and expand till the end of screen . Navigation bar should be hidden .

For this i have used this theme :

<style name="AppTheme.NoActionbarThemeDefaultStatusColor" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowActionBar">false</item>
</style

for my actiivity. And i also use below code in the oncreate method of my activity.

window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                    or View.SYSTEM_UI_FLAG_LOW_PROFILE)

Everything is fine i.e status bar is there , no navigation bar is there . But the layout's top part is hidden below status bar . I want layout to start after status bar . But not sure how to do this.

Pardeep Kumar
  • 900
  • 1
  • 14
  • 30

1 Answers1

0

Try this code...

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
         if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
            getWindow().setStatusBarColor(Color.TRANSPARENT);
}
        }
Shahzad Afridi
  • 2,058
  • 26
  • 24
  • this will show it properly. But the issue is that my layout starts from the top of the screen instead it should start after the status bar. Your solution will show the overlapped text , but the text will still start from the top of the screen – Pardeep Kumar Jul 18 '18 at 07:32