Android 常见问题及Solution积累

1. 当ListView的item里面有Button之类的可点击控件时,ListView的Item无法点击。

Solution:给item里面的Button之类的可点击控件加上android:focusable="false"

 

2. Drawable转化为bitmap:

	public static Bitmap drawableToBitmap (Drawable drawable) {
	    if (drawable instanceof BitmapDrawable) {
	        return ((BitmapDrawable)drawable).getBitmap();
	    }

	    Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Config.ARGB_8888);
	    Canvas canvas = new Canvas(bitmap); 
	    drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
	    drawable.draw(canvas);

	    return bitmap;
	}

  

 

posted on 2013-04-19 18:45  邹创  阅读(152)  评论(0)    收藏  举报

导航