标签: bottom-navigation-bar

如何更改React Native Paper底部导航活动颜色?

我想改变react-native-paper导航的颜色。我怎样才能改变颜色。我可以更改背景颜色,但无法更改活动选项卡圆形按钮的颜色。

图片链接 = https://i.stack.imgur.com/3Edpm.png

我想把粉红色变成蓝色我该如何改变。

import * as React from 'react';
import { BottomNavigation} from 'react-native-paper';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';


const Tab = createBottomTabNavigator();


const HomePage =({route,navigation})  => {
    const [index, setIndex] = React.useState(0);
    const [routes] = React.useState([
        { key: 'home', title: 'Home', focusedIcon: 'home', unfocusedIcon : 'home-outline',  },
        { key: 'orderHistory', title: 'Order History', focusedIcon: 'clock', unfocusedIcon: 'clock-outline' },
        { key: 'profile', title: 'Profile', focusedIcon: 'account', unfocusedIcon : 'account-outline'},
        { key: 'other', title: 'Other', focusedIcon: 'dots-horizontal-circle', unfocusedIcon: …
Run Code Online (Sandbox Code Playgroud)

reactjs react-hooks react-native-paper bottom-navigation-bar

7
推荐指数
2
解决办法
2841
查看次数

使用 URL 在底部导航栏项目图标内加载图像

我正在尝试使用底部导航栏的项目图标内的 firebase 存储 url 加载个人资料图像,这是我的代码:

 Glide.with(getApplicationContext()).asBitmap().load(profilePicUrl)
    .into(new CustomTarget<Bitmap>() {

        @Override
        public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
            Drawable profileImage = new BitmapDrawable(getResources(), resource);
            bottomNav.getMenu().getItem(4).setIcon(profileImage);
        }

        @Override
        public void onLoadCleared(@Nullable Drawable placeholder) {

        }
    });
Run Code Online (Sandbox Code Playgroud)

profilePicUrl确实有效,我已经将它用于另一个图像视图。但是,当我运行该应用程序时,图标的尺寸会根据我尝试加载的图片而变化,但内部没有图像,如下所示

java android android-glide bottom-navigation-bar

5
推荐指数
1
解决办法
858
查看次数

Jetpack 撰写。selectedContentColor 和 unselectedContentColor 在 BottomNavigationItem 中不起作用

我有代码:

@Composable
fun BottomNavigationBar(navController: NavController) {
    val items = listOf(
        BottomNavigationItem.One,
        BottomNavigationItem.Two,
        BottomNavigationItem.Three,
        BottomNavigationItem.Four,
        BottomNavigationItem.Five
    )
    BottomNavigation(
        backgroundColor = colorResource(id = R.color.teal_700),
        contentColor = Color.White
    ) {
        val navBackStackEntry by navController.currentBackStackEntryAsState()
        val currentRoute = navBackStackEntry?.destination?.route
        items.forEach { item ->
            BottomNavigationItem(
                icon = { Icon(painterResource(id = item.icon), contentDescription = item.title) },
                label = { Text(text = item.title) },
                selectedContentColor = Color.White,
                unselectedContentColor = Color.White.copy(0.4f),
                alwaysShowLabel = true,
                selected = currentRoute == item.route,
                onClick = {
                    navController.navigate(item.route) {
                        navController.graph.startDestinationRoute?.let { route -> …
Run Code Online (Sandbox Code Playgroud)

navigation android-jetpack-compose bottom-navigation-bar

2
推荐指数
1
解决办法
1254
查看次数