ConstraintLayout通知徽章

R K*_*mar 9 android android-layout android-constraintlayout

关于ConstraintLayout通知徽章

我已经使用ConstraintLayout进行通知,如下所示.

在这里我使用了ImageButton和textview 在此输入图像描述

出局:

在此输入图像描述

这里我使用了Button和textview

在此输入图像描述

输出:

在此输入图像描述

使用了imageview的按钮然后看起来像这样.可以帮助我在constraintLayout中解决这个问题.

例如: 在此输入图像描述

当我尝试使用按钮时,它会像这样显示.

如果您正在使用FrameLayout或RelativeLayout显示徽章,我必须知道的另一个新功能是对Button,ImageView或ImageButtom都正常工作.

但是长按或点击按钮通知徽章会回来,在Imageview和imagebutton中工作正常.

Oğu*_*gül 3

发生这种情况是因为 Button 有自己的高度。

海拔较高,可以看到前方的景色。

尝试为您的徽章添加更高的海拔,如下所示。

android:elevation="10dp"
Run Code Online (Sandbox Code Playgroud)

并且,您不想缩放图像,必须使用 ImageView 或 ImageButton。