[英]How to Make Custom Shaped Layout in Android
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. 因此,我尝试在其上使用带有FAB的LinearLayout,因为我对自定义形状的了解不多,但是当我滚动webView底栏隐藏项时,我的想法不起作用,但是fab却没有。 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 :) 非常感谢 :)
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 并在XML文件中将其添加为如下所示的背景
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:elevation="4dp"
android:background="@drawable/list" /> //Your drawable name here
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.