android - invisible view in WindowManager with type RGBA_8888 ImageView -
i use attribute, time not work.if remove attribute,i can see view , ok. know missed? mycode:
private boolean loadingdirect=false; private void addloading(){ loadingimg= new imageview(mcontext); android.view.windowmanager.layoutparams viewparams = new android.view.windowmanager.layoutparams(); viewparams.x=0; viewparams.y=0; viewparams.width=600; viewparams.height=600; // viewparams.type=pixelformat.rgba_8888; loadingimg.setimageresource(r.drawable.notice_loading); loadingimg.setvisibility(view.visible); loadingdirect=true; loadingimg.setonclicklistener(new onclicklistener(){ @override public void onclick(view v) { if(loadingdirect){ matrix matrix = new matrix(); matrix.setrotate(180); bitmapdrawable draw = (bitmapdrawable) mcontext.getresources().getdrawable(r.drawable.notice_loading); bitmap bitmap= draw.getbitmap(); bitmap=bitmap.createbitmap(bitmap,0, 0, bitmap.getwidth(),bitmap.getheight(),matrix,true); loadingimg.setimagebitmap(bitmap); loadingdirect=false; }else{ loadingimg.setimageresource(r.drawable.notice_loading); loadingdirect=true; } } }); try{ mwindowmanager.addview(loadingimg, viewparams); }catch(exception e){ log.d("noticeboarderror", "addloading"); } }
please take @ http://developer.android.com/reference/android/view/windowmanager.layoutparams.html
your viewparams.type not expect pixelformat.rgba_8888 or pixelformat.whatever; code compile because int numbers. not expected behavior.
Comments
Post a Comment