相关疑难解决方法(0)

在android中覆盖两个图像以设置imageview

我试图在我的应用程序中叠加两个图像,但它们似乎在我的canvas.setBitmap()线上崩溃.我究竟做错了什么?

private void test() {
    Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.t);
    Bitmap mBitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.tt);
    Bitmap bmOverlay = Bitmap.createBitmap(mBitmap.getWidth(), mBitmap.getHeight(), mBitmap.getConfig());
    Canvas canvas = new Canvas();
    canvas.setBitmap(bmOverlay);
    canvas.drawBitmap(mBitmap, new Matrix(), null);
    canvas.drawBitmap(mBitmap2, new Matrix(), null);
    testimage.setImageBitmap(bmOverlay);
}
Run Code Online (Sandbox Code Playgroud)

android image

98
推荐指数
3
解决办法
14万
查看次数

如何自定义切换按钮?

我期待自定义Switch按钮变为如下:

在此输入图像描述

怎么做到这一点?

android android-button android-styles android-switch

40
推荐指数
10
解决办法
10万
查看次数