android Dialog 底部彈出
、
if (dialShareDialog == null) {dialShareDialog = new Dialog(context, R.style.dialog);dialShareDialog.setContentView(R.layout.dialog_share);dialShareDialog.setCanceledOnTouchOutside(true);// 擷取對話方塊的視窗,並設定視窗參數WindowManager.LayoutParams lp=dialShareDialog.getWindow().getAttributes();lp.dimAmount=0.7f;dialShareDialog.getWindow().getDecorView().setPadding(0, 0, 0, 0); lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.height = WindowManager.LayoutParams.WRAP_CONTENT;dialShareDialog.getWindow().setGravity(Gravity.BOTTOM);}ImageView weixinIv = (ImageView) dialShareDialog.findViewById(R.id.share_weixin_iv);ImageView friendIv = (ImageView) dialShareDialog.findViewById(R.id.share_friend_iv);ImageView kongjianIv = (ImageView) dialShareDialog.findViewById(R.id.share_kongjian_iv);ImageView sinaIv = (ImageView) dialShareDialog.findViewById(R.id.share_sina_iv);weixinIv.setOnClickListener(shareOnClickListener);friendIv.setOnClickListener(shareOnClickListener);kongjianIv.setOnClickListener(shareOnClickListener);sinaIv.setOnClickListener(shareOnClickListener);dialShareDialog.show();
xml 檔案
自訂彈出層樣式