1
This commit is contained in:
@@ -22,8 +22,8 @@ public class NineGridView extends ViewGroup {
|
||||
|
||||
private static ImageLoader mImageLoader; //全局的图片加载器(必须设置,否者不显示图片)
|
||||
|
||||
private int singleImageSize = 250; // 单张图片时的最大大小,单位dp
|
||||
private float singleImageRatio = 1.0f; // 单张图片的宽高比(宽/高)
|
||||
private int singleImageSize = 220; // 单张图片时的最大大小,单位dp
|
||||
private float singleImageRatio = 2f; // 单张图片的宽高比(宽/高)
|
||||
private int maxImageSize = 9; // 最大显示的图片数
|
||||
private int gridSpacing = 3; // 宫格间距,单位dp
|
||||
private int mode = MODE_FILL; // 默认使用fill模式
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.text.TextPaint;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.ImageView;
|
||||
@@ -59,9 +60,12 @@ public class NineGridViewWrapper extends ImageView {
|
||||
if (mType == 2) {
|
||||
// canvas.drawColor(maskColor);
|
||||
// float baseY = getHeight() / 2 - (textPaint.ascent() + textPaint.descent()) / 2;
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon_image);
|
||||
canvas.translate(getWidth() / 2, getHeight() / 2);
|
||||
canvas.drawBitmap(bitmap, -50, -50, null);
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.bf);
|
||||
// canvas.translate(getWidth() / 2, getHeight() / 2);
|
||||
// canvas.drawBitmap(bitmap, 0, 0, null);
|
||||
|
||||
|
||||
canvas.drawBitmap(bitmap, getWidth()/2 - bitmap.getWidth() / 2, getHeight()/2 - bitmap.getHeight() / 2,null);
|
||||
}
|
||||
// if (mType == 2) {
|
||||
// Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.phone);
|
||||
|
||||
BIN
ninegridview/src/main/res/drawable/bf.png
Normal file
BIN
ninegridview/src/main/res/drawable/bf.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Reference in New Issue
Block a user