2017-04-16 103 views
7

关于ConstraintLayout通知标志ConstraintLayout通知标志

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

这里我用的ImageButton和TextView的 enter image description here

出来放:

enter image description here

这里我使用按钮和TextView的

enter image description here

输出:

enter image description here

insign of imageview is used by button it then it like this。 可以帮助我在constraintLayout中解决这个问题。

例如:enter image description here

当我tryed与按钮,它显示是这样的。

如果您使用FrameLayout或RelativeLayout显示徽章对Button,ImageView或ImageButtom都正常工作,我会知道一件新事物。

但长按或点击按钮通知徽章是返回,在Imageview和imagebutton它工作正常。

+0

你能尝试添加机器人:海拔=“0dp”为您的按钮 –

+0

我想如果海拔=“10dp”阴影显示 –

+0

我它不工作意思是使用0dp海拔按钮,不使用任何徽章 –

回答

2

发生这种情况,因为Button有自己的高程。

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

尝试向下面的徽章添加更高的高程。

android:elevation="10dp" 

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

+0

它不需要,如果我使用ImaeView或ImageButton,但我需要使用button.if我使用海拔它显示阴影。 –

+0

@RKiranKumar你为什么需要使用按钮?而android:elevation =“10dp”确实解决了你的问题? –

+0

我想试试按钮 –

2

在按钮XML使用此style="?android:attr/borderlessButtonStyle"

<Button 
     style="?android:attr/borderlessButtonStyle" 
     android:background="@mipmap/ic_launcher" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"/> 
+0

无边框按钮与基本按钮类似,不同之处在于它们没有边框或背景,但在不同状态期间仍会改变外观,例如点击时。 – CodeCameo

+0

如果它为你工作,你可以接受答案将来的参考。 – CodeCameo

+0

对不起,这是行不通的,如果我在背景中应用风格消失,这是不正确的。 –

0

最终我得到了上述问题

1解决方案:为按钮 的android:海拔不会怎么一回事,因为内部效果有提升。

instead of elevation use android:stateListAnimator="@null" 

2:其它按钮,然后抬高将工作