问题
I'm making a bottom navigation bar, of custom shape Like this =>
So I tried using LinearLayout with a FAB on it, as I dont know much about custom shapes, but my idea not working as, when I scroll my webView bottombar hides, but fab doesn't. Anyways this is a bad method.
So, What I want is to make a custom shaped bottombar, please help me make it, or just simple guiding would be helpful,
Thank you so much :)
回答1:
Create a drawable with the below fields
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="4dp"
android:left="20dp"
android:right="20dp"
android:top="15dp">
<shape android:shape="rectangle">
<solid android:color="#ED7D31" /> //Color of youe choice
</shape>
</item>
<item
android:width="50dp"
android:height="50dp"
android:gravity="top|center">
<shape android:shape="oval">
<solid android:color="#ED7D31" />
</shape>
</item>
</layer-list>
and in the XML file add it as a background like below
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:elevation="4dp"
android:background="@drawable/list" /> //Your drawable name here
来源:https://stackoverflow.com/questions/41596264/how-to-make-custom-shaped-layout-in-android