android - Using alpha mask on TextView removes parent view alpha as well? -
i'm trying have textview alpha linear gradient applied it, this:
i have implementation works, here's code:
public class mytextview extends textview { paint paint = new paint(); void init() { paint.setalpha(0xffffffff); paint.setxfermode(new porterduffxfermode(porterduff.mode.overlay)); paint.setshader( new lineargradient( 0, 0, getwidth(), getheight(), 0xffffffff, 0x00000000, shader.tilemode.clamp)); } void draw(canvas canvas) { super.draw(canvas); canvas.drawrect(0, 0, getwidth(), getheight(), paint); } } it sits in layout, has own translucent background:
<view background="#33000000"> <mytextview /> </view> the paint mode seems remove translucent background color of parent view. i'm not sure how stop draw code in textview class affecting background color of parent view?
thanks

Comments
Post a Comment