Another solution to the shadow effect of Android button

In versions after Android 5.0, when defining a button, the system will automatically add a shadow effect. Sometimes this effect looks better, and sometimes it does not meet the UI design requirements. At this time, you need to remove the shadow manually.

Many articles on the Internet have written a solution, which is to add a sentence style = "? Android: attr / borderlessbuttonstyle" to the button. This can indeed solve the problem, but it also brings another problem. Generally, when writing the layout, I will write a style for each control to facilitate reuse. For example, I wrote a button and cited a style, But this sentence has to add a style, which is definitely not good. At this time, there is another way to solve it, that is, add a parent to the style of button.

Add this parent = "@ style / widget. Appcompat. Button. Borderless" to eliminate the shadow.

The above is another solution to the shadow effect of Android button introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>