android - 如何在我的应用程序中添加小提示或消息,我应该使用库吗?
解决方案
我手动创建了如图所示的形状。如果你想在你的项目中使用,那么只需使用 layout_background.xml 文件作为布局的背景。
layout_background.xml
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:color="@color/colorPrimaryDark" android:width="1dp"/>
<solid android:color="#9308"/>
<corners android:topLeftRadius="400dp"/>
</shape>
例子.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_alignParentBottom="true"
android:background="@drawable/layout_background">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="104dp"
android:layout_marginTop="114dp"
android:text="Hello World"
android:textAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Title" />
</RelativeLayout>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="22dp"
android:layout_marginEnd="18dp" />
</RelativeLayout>
推荐阅读
- google-chrome - 扩展中消息传递的兼容性库,Firefox 与 Chrome
- python - 从文本文件制作元组列表
- typescript - 重写现有的 websocket 以与 typescript 一起使用
- java - 如何找到好的解决方案或优化解决方案
- python - ImportError:没有名为端点的模块
- c - 如何找到给定一个正确的面具?
- java - 如何让 Eclipse 动态 Web 项目在弹性 beantalk 中工作
- c++ - 使用 qprocess 运行 .exe
- java - 如何在 Java/Kotlin 中获取 NumberFormat 的语言环境?
- python - 训练Mask RCNN但总是从所有提案中得到0个正边界框?