The effect of the mask pop-up box and the mask pop-up

Source: Internet
Author: User

The effect of the mask pop-up box and the mask pop-up

Custom

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); // This code replaces the default dialog background; otherwise, the dialog edge is transparent and very wide. // in short, it cannot achieve the desired effect getWindow (). setBackgroundDrawableResource (android. r. color. transparent); registerView = View. inflate (this. context, R. layout. layout_register_dialog, null); setContentView (registerView); // This sentence plays the role of full screen 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: // register Intent intent = AppIntent. getRegPhoneActivity (this. context); context. startActivity (intent); this. dismiss (); break ;}}}

  

The usage is as follows:

new RegisterDialog(mContext).show();

  

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.