How can I dim my background when custom View is showing? In my Activity I have Relative Layout with some photo in background. When user do some action - FrameLayout appears in center of screen - and then I want make it to act like dialog - dim everything under framelayout.
How can I achieve that?
add this view over it.. it ll help you..
public class TransparentPanel extends LinearLayout {
private Paint innerPaint;
public TransparentPanel(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public TransparentPanel(Context context) {
super(context);
init();
}
private void init() {
innerPaint = new Paint();
innerPaint.setARGB(180, 75, 75, 75);
}
public void setInnerPaint(Paint innerPaint) {
this.innerPaint = innerPaint;
}
@Override
protected void dispatchDraw(Canvas canvas) {
RectF drawRect = new RectF();
drawRect.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
canvas.drawRoundRect(drawRect, 5, 5, innerPaint);
super.dispatchDraw(canvas);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With