简体   繁体   English

Android中带有透明图标的分层按钮

[英]Layered button with transparent icon in Android

Is it possible to make layered button in Android with transparent icon throgh first layer? 是否有可能在Android中使用透明图标throgh第一层制作分层按钮? It looks tricky, I could make different assets but is it possible to achieve it programmatically? 它看起来很棘手,我可以制作不同的资产但是有可能以编程方式实现吗? Example below 以下示例

例

EDIT: Icon has no background, only border. 编辑:图标没有背景,只有边框。

Seems easy enough. 看起来很简单。 Save the icon as a .png file, such that anything besides the arrow outline is transparent. 将图标另存为.png文件,使箭头轮廓以外的任何内容都是透明的。 Then it's a simple matter of drawing one ImageView on top of another ImageView, depending on what you want. 然后,根据您的需要,在另一个ImageView上绘制一个ImageView是一件简单的事情。

In order to tint the arrow, use a TintableImageView as described here . 要为箭头着色,请使用此处所述的TintableImageView。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM