【发布时间】:2019-01-10 08:07:05
【问题描述】:
我下面有一张位图,不是纯白色的,有一些噪点:
如何设置BottomAppBar的背景,bitmap.xml如下,
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/bg"
android:tileModeX="repeat"
android:tileModeY="repeat" />
在我的activity_main.xml中,我使用它如下:
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bottom_app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/bitmap"
app:fabAlignmentMode="center"
app:fabAnimationMode="scale"
app:navigationIcon="@drawable/ic_settings" />
但是不行,BottomAppBar的背景不显示位图,仍然是纯白色,我在其他布局中成功使用了bitmap.xml,但是BottomAppBar不起作用。
我把xml的android:background="@drawable/bitmap"改成java代码:
bottomAppBar.setBackground(getResources().getDrawable(R.drawable.bitmap));
但也有问题,往下看
【问题讨论】:
标签: android material-design android-bottomappbar