简体   繁体   English

在Android中突出显示Drawable上的边缘

[英]Highlight edge on Drawable in Android

When i have an ImageButton and a drawable and i want to do something like the Drawer or Twitter where when i press the button and the corner of the image is highlighted over the edge, in drawer its yellow, in twitter its white. 当我有一个ImageButton和一个drawable,我想做一些像Drawer或Twitter,当我按下按钮,图像的一角突出显示在边缘,在抽屉黄色,在twitter白色。 Like the one below. 就像下面那个。
替代文字
How do i set my drawable without using a lot of images? 如何在不使用大量图像的情况下设置drawable?

If you would like just to replace one color of a Drawable with another in runtime you can try to modify a Bitmap directly. 如果您只想在运行时将一种Drawable替换为另一种颜色,可以尝试直接修改Bitmap。 You can find a similar example here . 你可以在这里找到一个类似的例子。

But to my mind, using drawable XML resource with several Drawables for different button states is more likely to be an android way. 但在我看来,使用具有多个Drawables的可绘制XML资源用于不同的按钮状态更可能是一种android方式。

Regards, Serge 问候,塞尔

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

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