[英]How to create bottom navigation with floating action button
How to create this design如何创建此设计
I have used this code but not get expected result我使用了这段代码但没有得到预期的结果
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true">
<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"
app:backgroundTint="@color/colorPrimary"
app:fabAlignmentMode="center" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_plus"
app:backgroundTint="@android:color/transparent"
app:fabAlignmentMode="center"
app:fabCradleRoundedCornerRadius="2dp"
app:layout_anchor="@id/bottom_app_bar" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
ic_plus.xml ic_plus.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<gradient
android:angle="180"
android:endColor="#FFFF8B00"
android:startColor="#FFFF4806" />
<size
android:width="56dp"
android:height="56dp" />
</shape>
</item>
<item
android:left="10dp"
android:right="10dp">
<shape android:shape="line">
<stroke
android:width="2dp"
android:color="#ffffff" />
</shape>
</item>
<item
android:left="10dp"
android:right="10dp">
<rotate android:fromDegrees="90">
<shape android:shape="line">
<stroke
android:width="2dp"
android:color="#ffffff" />
</shape>
</rotate>
</item>
</layer-list>
dimens.xml维度.xml
<dimen name="design_fab_image_size" tools:override="true">56dp</dimen>
In Menifest
在
Menifest
android:theme="@style/Theme.MaterialComponents.NoActionBar"
But I am getting this但我明白了
Any help will be appreciated.任何帮助将不胜感激。 Thanks
谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.