Изменить цвет навигации нижнего листа в Android

Чтобы изменить цвет навигации нижнего листа в Android, вы можете использовать различные методы. Вот несколько подходов с примерами кода:

Метод 1: изменение цвета фона нижнего листа
Вы можете установить цвет фона нижнего листа, чтобы настроить его внешний вид. Вот пример использования BottomSheetDialogFragment:

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

        // Set the background color of the bottom sheet
        view.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.your_color));
        return view;
    }
}

Метод 2: использование пользовательского макета для нижнего листа.
Вы можете создать собственный макет для нижнего листа и установить цвет его фона. Вот пример:

Создайте файл макета custom_bottom_sheet.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/your_color"
    android:orientation="vertical">
    <!-- Add your content here -->
</LinearLayout>

В вашем BottomSheetDialogFragment:

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

        // Find and customize views in the custom layout as needed
        return view;
    }
}

Метод 3: использование пользовательской темы для нижнего листа.
Вы можете определить собственную тему для нижнего листа и указать цвет навигации в этой теме. Вот пример:

В вашем файле styles.xml:

<style name="BottomSheetTheme" parent="Theme.Design.Light.BottomSheetDialog">
    <item name="android:navigationBarColor">@color/your_color</item>
</style>

В вашем BottomSheetDialogFragment:

public class MyBottomSheetDialogFragment extends BottomSheetDialogFragment {
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Set the custom theme for the bottom sheet
        setStyle(DialogFragment.STYLE_NORMAL, R.style.BottomSheetTheme);
    }
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_bottom_sheet, container, false);

        // Find and customize views in the layout as needed
        return view;
    }
}