List of usage examples for android.view View setFitsSystemWindows
public void setFitsSystemWindows(boolean fitSystemWindows)
From source file:fr.outadev.skinswitch.DetailActivity.java
@TargetApi(Build.VERSION_CODES.KITKAT_WATCH) private void applySystemWindowsBottomInset() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) { View containerView = findViewById(R.id.container); containerView.setFitsSystemWindows(true); containerView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override// w ww . ja va2s. c om public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) { DisplayMetrics metrics = getResources().getDisplayMetrics(); if (metrics.widthPixels < metrics.heightPixels) { view.setPadding(0, 0, 0, windowInsets.getSystemWindowInsetBottom()); } else { view.setPadding(0, 0, windowInsets.getSystemWindowInsetRight(), 0); } return windowInsets.consumeSystemWindowInsets(); } }); } }