android - 如何创建不同形状的浮动操作按钮
问题描述
我正在尝试获得一个浮动操作按钮,但大小不同,我尝试了一些链接,但没有一个有效。任何帮助都会很棒
我尝试了代码,并尝试在底部导航视图上方拍摄图像视图。但是点击片段后,它就消失了。
<com.jediburrell.customfab.FloatingActionButton
android:id="@+id/floating_action_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
app:fabType="custom"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
app:fabShape="@drawable/fab_teardrop"
app:fabColor="@color/red" />
我正在尝试制作椭圆形的晶圆厂
解决方案
下面是工作代码
椭圆形.xml(形状)
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/colorPrimary" />
</shape>
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:layout_width="82dp"
android:layout_height="65dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_margin="16dp"
android:background="@drawable/oval"
android:src="@android:drawable/ic_dialog_map"
app:backgroundTint="@drawable/oval" />
</RelativeLayout>
让我知道以获得更多帮助
推荐阅读
- python-3.x - 为什么拖动视图项时视图有很多阴影?
- maven - 为什么在存储库部分找不到该属性?
- node.js - TypeORM - 从 Postgres 中获取匹配(和相关)行
- string - 熊猫'groupby'数据框,如果'item1和'item2'在同一个组中,如何过滤?
- arrays - Powershell:将数组添加为另一个数组的成员
- python - 仅在左侧绘制 matplotlib 断轴
- kubernetes-helm - 配置 'bitnami/nginx-ingress-controller' Helm 图表以使用预先存在的负载均衡器
- azure - Terraform Azure - for_each 变量混淆
- flutter - 给定 json 响应如何使用 dio 绑定列表颤振?
- angular - 三 JS 作为 Angular 组件的滚动问题