android – 高程阴影被剪裁

android – 高程阴影被剪裁,第1张

概述我尝试将高程添加到我的自定义按钮,但结果是: image of the shadow 正如您所看到的,阴影在按钮下方显示效果不佳.我试图在stackoverflow和谷歌搜索,我发现类似的问题,但没有答案:) XML: <Button android:id="@+id/email_sign_in_button" android:layout_width="141dp" andro 我尝试将高程添加到我的自定义按钮,但结果是:
image of the shadow

正如您所看到的,阴影在按钮下方显示效果不佳.我试图在stackoverflow和谷歌搜索,我发现类似的问题,但没有答案:)

XML:

<button   androID:ID="@+ID/email_sign_in_button"   androID:layout_wIDth="141dp"   androID:layout_height="45dp"   androID:textAlignment="gravity"   androID:text="@string/action_sign_in"   androID:gravity="center_horizontal"   androID:elevation="4dp" />

这是我的自定义按钮样式.
button.xml:

<?xml version="1.0" enCoding="utf-8"?><selector xmlns:androID="http://schemas.androID.com/apk/res/androID"><item    androID:state_enabled="false"    androID:drawable="@drawable/button_Disabled" /><item    androID:state_pressed="true"    androID:state_enabled="true"    androID:drawable="@drawable/button_pressed" /><item    androID:state_focused="true"    androID:state_enabled="true"    androID:drawable="@drawable/button_regular" /><item    androID:state_enabled="true"    androID:drawable="@drawable/button_regular" /></selector>

没有按下的样式.
button_regular.xml:

<?xml version="1.0" enCoding="UTF-8"?><shape xmlns:androID="http://schemas.androID.com/apk/res/androID"><gradIEnt androID:angle="-90"    androID:centerX="10"    androID:centerY="10"    androID:endcolor="#30bbff"    androID:gradIEnTradius="10"    androID:startcolor="#0081c0"    androID:type="linear"/><stroke androID:wIDth="5dip" androID:color="#ffffff" /><corners androID:radius="20dip"/><padding androID:left="7dp"    androID:top="7dp"/></shape>

请帮忙!

解决方法 你的阴影可能会受到视图边界的限制.尝试在按钮底部添加填充.

如果按钮位于父级的底部,则父VIEwGroup也可能会剪切阴影.确保父级有填充并在父级上设置androID:clipTopadding =“false”.

总结

以上是内存溢出为你收集整理的android – 高程阴影被剪裁全部内容,希望文章能够帮你解决android – 高程阴影被剪裁所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1134634.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存