Here you can find the source of getBackground(int bgcolor)
Parameter | Description |
---|---|
bgcolor | a parameter |
public static Bitmap getBackground(int bgcolor)
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Canvas; public class Main { /**//from ww w. j ava2 s. c om * Helper to create a bitmap to set as imageview or bg * @param bgcolor * @return bitmap */ public static Bitmap getBackground(int bgcolor) { try { Bitmap.Config config = Bitmap.Config.ARGB_8888; Bitmap bitmap = Bitmap.createBitmap(2, 2, config); Canvas canvas = new Canvas(bitmap); canvas.drawColor(bgcolor); return bitmap; } catch (Exception e) { return null; } } }