I have a bitmap below,it's not pure white,has some noisy point:
How to set BottomAppBar's background as it,bitmap.xml is below,
<?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" />
in my activity_main.xml,I use it as below:
<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" />
but it not work,BottomAppBar's background not show the bitmap,is still pure white,I use the bitmap.xml successfully in other layout,but BottomAppBar not work.
I change xml's android:background="@drawable/bitmap" to java code:
bottomAppBar.setBackground(getResources().getDrawable(R.drawable.bitmap));
but also has issue,look below
center circle should be like below, but arround now it's all background bitmap:
Looks like this isn't possible. According to this:
The BottomAppBar internally handles its own background. This allows it to automatically cradle the FloatingActionButton when it is attached, but it also means that you shouldn’t call setBackground() or use the android:background attribute in xml. Instead, the app:backgroundTint attribute will allow you to set a tint.