Android實(shí)現(xiàn)蒙版彈出框效果-創(chuàng)新互聯(lián)

本文實(shí)例為大家分享了Android蒙版彈出框效果的具體代碼,供大家參考,具體內(nèi)容如下

創(chuàng)新互聯(lián)公司專(zhuān)業(yè)為企業(yè)提供崇信網(wǎng)站建設(shè)、崇信做網(wǎng)站、崇信網(wǎng)站設(shè)計(jì)、崇信網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、崇信企業(yè)網(wǎng)站模板建站服務(wù),十多年崇信做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。

自定義

package cn.lxsdb.yyd.app.dialog; 
 
import cn.lxsdb.yyd.app.R; 
import cn.lxsdb.yyd.app.constants.AppIntent; 
import android.app.Dialog; 
import android.content.Context; 
import android.content.Intent; 
import android.os.Bundle; 
import android.view.MotionEvent; 
import android.view.View; 
import android.view.Window; 
import android.view.WindowManager.LayoutParams; 
import android.widget.ImageButton; 
 
public class RegisterDialog extends Dialog implements 
  android.view.View.OnClickListener { 
 
 private ImageButton cancel; 
 private ImageButton experienceNow; 
 Context context; 
 View registerView; 
  
 
 public RegisterDialog(Context context) { 
  super(context); 
  this.context = context; 
 } 
 
 @Override 
 protected void onCreate(Bundle savedInstanceState) { 
  super.onCreate(savedInstanceState); 
  requestWindowFeature(Window.FEATURE_NO_TITLE); 
 
  // 這句代碼換掉dialog默認(rèn)背景,否則dialog的邊緣發(fā)虛透明而且很寬 
  // 總之達(dá)不到想要的效果 
  getWindow().setBackgroundDrawableResource(android.R.color.transparent); 
  registerView = View.inflate(this.context, R.layout.layout_register_dialog, null); 
  setContentView(registerView); 
  // 這句話起全屏的作用 
  getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); 
 
  initView(); 
  initListener(); 
 } 
 
 @Override 
 public boolean onTouchEvent(MotionEvent event) { 
  this.dismiss(); 
  return super.onTouchEvent(event); 
 } 
 
 private void initListener() { 
  cancel.setOnClickListener(this); 
  experienceNow.setOnClickListener(this); 
 } 
 
 private void initView() { 
  cancel = (ImageButton) findViewById(R.id.ib_close); 
  experienceNow = (ImageButton) findViewById(R.id.ib_register_now); 
 
 } 
 
 public void onClick(View v) { 
  switch (v.getId()) { 
  case R.id.ib_close: 
   this.dismiss(); 
   break; 
  case R.id.ib_register_now: 
   // 注冊(cè) 
   Intent intent = AppIntent.getRegPhoneActivity(this.context); 
   context.startActivity(intent); 
   this.dismiss(); 
   break; 
  } 
 } 
} 

文章題目:Android實(shí)現(xiàn)蒙版彈出框效果-創(chuàng)新互聯(lián)
網(wǎng)址分享:http://muchs.cn/article6/dshoog.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供全網(wǎng)營(yíng)銷(xiāo)推廣、網(wǎng)頁(yè)設(shè)計(jì)公司、品牌網(wǎng)站制作、外貿(mào)建站、企業(yè)建站、手機(jī)網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司