android界面xml背景颜色,android

在Android开发中,作者创建了一个包含BottomNavigationView的XML布局文件。尽管在预览中背景颜色显示为红色,但在实际设备上运行时,背景颜色变成了蓝色。问题可能涉及颜色资源、样式或设备特定渲染差异。寻求帮助以解决颜色渲染不一致的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我定义了一个包含两个项目的可绘制XML文件。 这是代码

首先是MainActivity Layout:

xmlns:app="http://schemas.android.com/apk/res-auto"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

tools:context=".MainActivity">

android:layout_width="match_parent"

android:layout_height="match_parent">

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:id="@+id/relLayout1">

android:layout_width="match_parent"

android:layout_height="match_parent"

android:id="@+id/relLayout2"

android:layout_below="@id/relLayout1"

android:background="@color/white">

在layout_bottom_navigation中,我使用了BottomNavigationEX

xmlns:app="http://schemas.android.com/apk/res-auto">

android:layout_width ="match_parent"

android:layout_height="50dp"

android:layout_alignParentBottom="true">

android:layout_width="match_parent"

android:layout_height="match_parent"

android:id="@+id/bottomNavViewBar"

android:background="@drawable/white_grey_border_top"

app:menu="@menu/bottom_navigation_menu">

然后我在bottom_Navigation_menu中定义了这样的MenuItems

android:id="@+id/ic_house"

android:icon="@drawable/ring_cicle_home"

android:title="">

android:id="@+id/ic_search"

android:icon="@drawable/ring_cicle_search"

android:title="">

android:id="@+id/ic_circle"

android:icon="@drawable/ic_circle"

android:title="">

android:id="@+id/ic_alert"

android:icon="@drawable/ic_alert"

android:title="">

android:id="@+id/ic_android"

android:icon="@drawable/ic_android"

android:title="">

这是ring_circle_search

android:innerRadius="25dp"

android:shape="ring"

android:thickness="5dp"

android:useLevel="false">

android:left="11dp"

android:right="11dp"/>

android:drawable="@drawable/ic_search"

android:width="40dp"

android:height="50dp"/>

预览显示如下:

aHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9KVTBXVy5wbmc=

但是红色背景不会在android设备中呈现。 而是变成蓝色的原色。

任何人都可以指出是什么问题吗?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值