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

自定義
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;
}
}
}
用法如下:
new RegisterDialog(mContext).show();
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- Android自定義底部彈出框ButtomDialog
- Android仿微信網(wǎng)絡(luò)加載彈出框
- Android自定義view仿iOS彈出框效果
- Android使用popUpWindow帶遮罩層的彈出框
- Android實(shí)現(xiàn)底部半透明彈出框PopUpWindow效果
- Android自定義彈出框dialog效果
- Android 多種簡(jiǎn)單的彈出框樣式設(shè)置代碼
- Android實(shí)現(xiàn)可輸入數(shù)據(jù)的彈出框
- Android使用Dialog風(fēng)格彈出框的Activity
- android自定義彈出框樣式的實(shí)現(xiàn)方法
相關(guān)文章
android如何取得本地通訊錄的頭像的原圖的實(shí)現(xiàn)代碼
這篇文章主要介紹了android如何取得本地通訊錄的頭像的原圖的實(shí)現(xiàn)代碼,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-12-12
Android高級(jí)開發(fā)之性能優(yōu)化典范
本文從電量,視圖,內(nèi)存三個(gè)性能方面的知識(shí)點(diǎn)給大家介紹android高級(jí)開發(fā)之性能優(yōu)化的相關(guān)知識(shí),希望對(duì)大家有所幫助2016-05-05
Android編程滑動(dòng)效果之倒影效果實(shí)現(xiàn)方法(附demo源碼下載)
這篇文章主要介紹了Android編程滑動(dòng)效果之倒影效果實(shí)現(xiàn)方法,基于繼承BaseAdapter自定義Gallery和ImageAdapter實(shí)現(xiàn)倒影的功能,并附帶demo源碼供讀者下載參考,需要的朋友可以參考下2016-02-02
android View 繪制完成監(jiān)聽的實(shí)現(xiàn)方法
今天小編就為大家分享一篇android View 繪制完成監(jiān)聽的實(shí)現(xiàn)方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-09-09
Android studio listview實(shí)現(xiàn)列表數(shù)據(jù)顯示 數(shù)據(jù)循環(huán)顯示效果
這篇文章主要介紹了Android studio listview實(shí)現(xiàn)列表數(shù)據(jù)顯示 數(shù)據(jù)循環(huán)顯示功能,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-04-04
Android使用Matrix旋轉(zhuǎn)圖片模擬碟片加載過程
這篇文章主要為大家詳細(xì)介紹了Android使用Matrix旋轉(zhuǎn)圖片模擬碟片加載過程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-03-03

