[Android] Canvas

Android 2012. 7. 13. 11:57





protected void onDraw(Canvas canvas) {

//사각형 그리기


Paint pnt = new Paint();


pnt.setStrokeWidth(3);                //선굵기

pnt.setStyle(Paint.Style.STROKE);  //외곽선만


pnt.setARGB(255, 255, 255, 255);

canvas.drawRect(0,0,50,50,pnt);

}



Posted by tenn
,




타이틀바 제거


<< Code >>

    requestWindowFeature(Window.FEATURE_NO_TITLE);

 or


<< layout.xml >>

android:theme="@android:style/Theme.NoTitleBar"





가로, 세로 화면 방향 설정


setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); 

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 



Posted by tenn
,


Recycle Bitmap


액티비티가 destroy될 때 해제. 안하고 놔두면 뻗는다.


protected void onDestroy(){

bitmap.recycle();

bitmap = null;

}



Recycle ImageView's Bitmap


((BitmapDrawable)picView.getDrawable()).getBitmap().recycle();



Posted by tenn
,