如何将带有圆角的android BottomAppBar [英] How to put the android BottomAppBar with rounded corners

查看:350
本文介绍了如何将带有圆角的android BottomAppBar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在这样使用Google的BottomAppBar:

I am using the BottomAppBar from google like this:

 <com.google.android.material.bottomappbar.BottomAppBar
            android:id="@+id/vNavigationBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

自定义底部栏是平坦的,我需要在底部栏上添加圆角(图像示例如下)

The custom bottom bar is flat and I need to add rounded corners on the Bottom bar(image example bellow)

我应该怎么做才能做到这一点?

What should I do to make this work this way?

推荐答案

您可以尝试添加可绘制形状的xml文件,并向其中添加以下代码

you can try add a shape drawable xml file and add the following code to it

<corners
    android:topLeftRadius="16dp"
    android:topRightRadius="16dp" />

然后将BottomAppBar的背景设置为drawable

And then set the BottomAppBar's background to the drawable

这篇关于如何将带有圆角的android BottomAppBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆