我想改变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
我正在尝试使用底部导航栏的项目图标内的 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
确实有效,我已经将它用于另一个图像视图。但是,当我运行该应用程序时,图标的尺寸会根据我尝试加载的图片而变化,但内部没有图像,如下所示。
我有代码:
@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)