PopupWindow

作者: Trainee | 来源:发表于2016-11-28 15:47 被阅读0次

    //初始化View

    View spinnerview= View.inflate(InstantFindCarActivity.this,R.layout.findcar_spinner,null);       

    //@param View  , width , height , isfocus

    spinner=new PopupWindow(spinnerview,findcarspinner.getWidth(), WindowManager.LayoutParams.WRAP_CONTENT,true);

    spinner.setTouchable(true);

    spinner.setAnimationStyle(R.style.mypopwindow_anim_style);

    /*设置了背景之可以点击window以外的地方消失*/

    spinner.setBackgroundDrawable(getDrawable());

    spinner.showAsDropDown(v);

    获得透明背景图片的方法

    privateDrawablegetDrawable(){

    ShapeDrawable bgdrawable =newShapeDrawable(newOvalShape());

    bgdrawable.getPaint().setColor(InstantFindCarActivity.this.getResources().getColor(android.R.color.transparent));

    returnbgdrawable;

    }

    相关文章

      网友评论

        本文标题:PopupWindow

        本文链接:https://www.haomeiwen.com/subject/uiyopttx.html