4

in my theme for API 27 I want to have a white navigation bar, which works fine, but when I show my bottomSheetDialogFragment the system dimmend my navigation bar like in a Dialog. Is it without the new components from the new material theme possible to prevent the dimming from the navigation bar? Here are some code snippets:

// Theme API 27

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowLightNavigationBar">true</item>
    <item name="android:navigationBarColor">@android:color/white</item>
    <item name="android:navigationBarDividerColor">@color/colorDivider</item>        
</style>

// BottomSheet

public class MenuBottomSheet extends BottomSheetDialogFragment {

    public static MenuBottomSheet newInstance(Bundle bundle) {
        MenuBottomSheet sheet = new MenuBottomSheet();
        sheet.setArguments(bundle);
        return sheet;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.sheet_menu, container, false);

        View sheetLayout = view.findViewById(R.id.sheet_menu_layout);
        final BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(sheetLayout);
        bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);

        return view;
    }
}

// Show BottomSheet

   private void showItemMenu(final Bundle args) {
        FragmentManager fragmentManager = getFragmentManager();
        if (fragmentManager != null) {
            MenuBottomSheet menuSheet = MenuBottomSheet.newInstance(args);
            menuSheet.setTargetFragment(this, REQUEST_CODE);
            menuSheet.show(fragmentManager, null);
        }
    }

I Finally find a solution by ma self:

Prevent BottomSheetDialogFragment covering navigation bar

Denis Schura
  • 761
  • 6
  • 10

0 Answers0