1
This commit is contained in:
@@ -75,4 +75,7 @@ public class MyPhoneValue {
|
||||
|
||||
return sbar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.support.annotation.ColorInt;
|
||||
@@ -28,7 +29,13 @@ public class QRCodeUtil {
|
||||
public static Bitmap createQRCodeBitmap(String content, int width, int height){
|
||||
return createQRCodeBitmap(content, width, height, "UTF-8", "H", "2", Color.BLACK, Color.WHITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
|
||||
*/
|
||||
public static int dip2px(Context context, float dpValue) {
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (dpValue * scale + 0.5f);
|
||||
}
|
||||
/**
|
||||
* 创建二维码位图 (支持自定义配置和自定义样式)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user