我有一个背景图像的布局,并有一个按钮.按钮的背景颜色是白色.现在我想在其上写一个文本,使文本显示按钮后面的任何内容(如透明文本).现在,显然,如果我使文本颜色透明,文本将消失,我将看到一个没有文本的白色按钮.这该怎么做?
截图:

我尝试使用Porter-Duff Xfermodes在我的Android应用程序中擦除部分位图.
我有一个绿色背景,由蓝色位图覆盖.当我触摸屏幕时,应该创建覆盖位图中的"洞",使绿色背景可见.而不是一个洞,我当前的代码产生一个黑点.
以下是我的代码.任何想法,我在这里做错了什么?
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(new DrawView(this));
}
public class DrawView extends View implements OnTouchListener {
private int x = 0;
private int y = 0;
Bitmap bitmap;
Canvas bitmapCanvas;
private final Paint paint = new Paint();
private final Paint eraserPaint = new Paint();
public DrawView(Context context) {
super(context);
setFocusable(true);
setFocusableInTouchMode(true);
this.setOnTouchListener(this);
// Set background
this.setBackgroundColor(Color.GREEN);
// Set bitmap
bitmap = Bitmap.createBitmap(320, 480, …Run Code Online (Sandbox Code Playgroud) 在Flutter中显示裁剪/蒙版图像的最佳方法是什么?
假设我有一个带有遮罩的图像(例如,具有透明背景的不规则星形)和另一个我想要用这个星遮蔽的图像,因此只会渲染原始图像的星内部分.
我的目标是PorterDuffXfermodeAndroid上的东西(类似的问题在这里 - Android如何在ImageView上应用蒙版?).
如果简单的面具形状是RenderClipOval一个好方法的方式?