android - 自定义浮动操作按钮
解决方案
制作此视图时出现问题。
- FloatingActionButton 隐藏所有视图。所以你的点视图不能放在FAB上。所以我们必须制作 ImageView 而不是 FAB。
把它放在你的布局中。
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/blue_circle"
android:padding="15dp"
android:src="@mipmap/ic_launcher" />
<ImageView
android:layout_width="13dp"
android:layout_height="13dp"
android:layout_gravity="top|right"
android:src="@drawable/red_circle" />
</FrameLayout>
在里面创建新的xmlres>drawable>blue_circle_gradient.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<gradient
android:endColor="#8e81fc"
android:startColor="#7264EA" />
</shape>
在里面创建新的xmlres>drawable>red_circle.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#ff0000" />
</shape>
输出将是这样的:
推荐阅读
- ubuntu - 有人可以告诉我如何在 lubuntu 上将 python 添加到我的路径环境变量中吗?
- reactjs - 仅使用来自另一个集合的 id 填充数据
- jquery - 幻灯片自动的问题:它对齐奇怪的元素
- python - 在python的未读邮件中从特定人那里获取附件
- mysql - MySQL 存储过程失败并出现错误 1064 (42000)
- amazon-web-services - 添加 EIP 后 EC2 公共 IPv4 变得无法访问
- laravel - Laravel:无法上传视频和图像文件
- java - 如何从没有实例名称的 main 中的另一个类调用 void 方法?
- google-cloud-platform - Informatica byol /IICS vs google data flow /data proc 需要的利弊
- vue.js - 如何使用 Nuxt 组件将参数传递给 vuex getter 方法?(同时保持三点符号)