PopupMenu.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:FloatingApps 作者:
public void showAtLocation(final View v, int x, int y) {
    final PopupMenu that = this;
    this.window.setOnDismissListener(new PopupWindow.OnDismissListener() {
        public void onDismiss() {
            that.main_layout.removeAllViews();
        }
    });

    this.main_layout = new LinearLayout(this.ctx);
    LayerDrawable layerDrawable = new LayerDrawable(new Drawable[] { (NinePatchDrawable)this.ctx.getResources().getDrawable(android.R.drawable.dialog_frame), new ColorDrawable(Color.WHITE) });
    layerDrawable.setLayerInset(0, Utils.dip2px(this.ctx, 5), Utils.dip2px(this.ctx, 5) + 3, Utils.dip2px(this.ctx, 5), Utils.dip2px(this.ctx, 5));
    this.main_layout.setBackgroundDrawable(layerDrawable);
    this.main_layout.addView(this.contentViewLayout);
    this.window.setContentView(this.main_layout);
    this.window.setWidth(this.width);
    this.window.setHeight(this.height);
    this.window.showAsDropDown(v, x, y);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号