欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Android自定義Dialog內(nèi)部透明、外部遮罩效果

本文實例為大家分享了Android自定義Dialog遮罩效果的具體代碼,供大家參考,具體內(nèi)容如下

十余年專注成都網(wǎng)站制作,企業(yè)網(wǎng)站建設(shè),個人網(wǎng)站制作服務(wù),為大家分享網(wǎng)站制作知識、方案,網(wǎng)站設(shè)計流程、步驟,成功服務(wù)上千家企業(yè)。為您提供網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)頁設(shè)計及定制高端網(wǎng)站建設(shè)服務(wù),專注于企業(yè)網(wǎng)站建設(shè),高端網(wǎng)頁制作,對成都石雕等多個領(lǐng)域,擁有豐富的營銷推廣經(jīng)驗。

圖例:

Android自定義Dialog內(nèi)部透明、外部遮罩效果

代碼

1、自定義dialog:引入樣式和代碼指定樣式

package com.gxjl.pe.gxjlpesdk.view;
 
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
 
import com.gxjl.pe.gxjlpesdk.R;
 
/**
 * 相機(jī)、相冊選擇 彈框
 * Created by xiaoshuai on 2018/8/20.
 */
 
public abstract class CameraPhotoDialog extends Dialog implements View.OnClickListener{
 private Context context;
 
 public CameraPhotoDialog(@NonNull Context context) {
  super(context, R.style.dialogTransparent);//內(nèi)容樣式在這里引入
 
  this.context = context;
 }
 
 public CameraPhotoDialog(@NonNull Context context, int themeResId) {
  super(context, themeResId);
 }
 
 protected CameraPhotoDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
  super(context, cancelable, cancelListener);
 }
 
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
 
  setContentView(R.layout.dialog_camrea_photo);
 
 //tv_title = findViewById(R.id.tv_title);
 
  Window dialogWindow = getWindow();
  WindowManager.LayoutParams lp = dialogWindow.getAttributes();
  DisplayMetrics d = context.getResources().getDisplayMetrics(); // 獲取屏幕寬、高用
  lp.width = (int) (d.widthPixels * 0.9); // 寬度設(shè)置為屏幕寬度的80%
  //lp.dimAmount=0.0f;//外圍遮罩透明度0.0f-1.0f
  dialogWindow.setAttributes(lp);
  dialogWindow.setGravity(Gravity.BOTTOM);//內(nèi)圍區(qū)域底部顯示
 
 }
 
 @Override
 public void onClick(View view) {
  int i = view.getId();
  if (i == R.id.tv_cancel) {
   this.dismiss();
  }
 }
 
 protected abstract void confirm();
}

2、dialog_camrea_photo.xml 布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:background="@android:color/transparent"
 android:orientation="vertical">
 
 <LinearLayout
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:layout_marginBottom="10dp"
  android:background="@android:color/transparent"
  android:orientation="vertical">
 
  <LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:background="@drawable/bg_camera_check"
   android:orientation="vertical">
 
   <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="15dp"
    android:layout_gravity="center_horizontal"
    android:text="拍照"
    android:textSize="16sp"
    android:textColor="@color/font_007AFF"/>
 
   <View
    android:layout_width="match_parent"
    android:layout_height="1dp"
    android:background="@color/line_ECECED"/>
 
   <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="15dp"
    android:layout_gravity="center_horizontal"
    android:text="照片圖庫"
    android:textSize="16sp"
    android:textColor="@color/font_007AFF"/>
  </LinearLayout>
 
  <LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_marginTop="10dp"
   android:background="@drawable/bg_camera_check"
   android:orientation="vertical">
 
   <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="15dp"
    android:layout_gravity="center_horizontal"
    android:text="拍照"
    android:textSize="16sp"
    android:textColor="@color/font_007AFF"/>
  </LinearLayout>
 </LinearLayout>
</LinearLayout>

3、style.xml 樣式布局:指定dialog內(nèi)容樣式

<?xml version="1.0" encoding="utf-8"?>
<resources>
 
 <style name="dialogTransparent" parent="@android:style/Theme.Dialog">
  <item name="android:windowFrame">@null</item> <!--邊框-->
  <item name="android:windowIsFloating">true</item> <!--是否浮現(xiàn)在activity之上-->
  <item name="android:windowIsTranslucent">true</item> <!--半透明-->
  <item name="android:windowNoTitle">true</item> <!--無標(biāo)題-->
  <item name="android:background">@android:color/transparent</item> <!--背景透明-->
  <item name="android:windowBackground">@android:color/transparent</item> <!--背景透明-->
  <item name="android:backgroundDimEnabled">true</item> <!--模糊-->
  <item name="android:backgroundDimAmount">0.6</item> <!--背景透明度-->
 </style>
</resources>

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持創(chuàng)新互聯(lián)。

當(dāng)前題目:Android自定義Dialog內(nèi)部透明、外部遮罩效果
鏈接URL:http://chinadenli.net/article36/ppcosg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、搜索引擎優(yōu)化、響應(yīng)式網(wǎng)站營銷型網(wǎng)站建設(shè)、面包屑導(dǎo)航、企業(yè)網(wǎng)站制作

廣告

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

h5響應(yīng)式網(wǎng)站建設(shè)
欧美乱码精品一区二区三| 丰满熟女少妇一区二区三区| 亚洲高清中文字幕一区二区三区| 九九热精品视频在线观看| 色偷偷偷拍视频在线观看| 91蜜臀精品一区二区三区| 国产成人免费激情视频| 欧美日韩国产精品黄片| 91精品视频免费播放| 国产精品亚洲一区二区| 日韩欧美中文字幕av| 精品欧美一区二区三久久| 大胆裸体写真一区二区| 亚洲欧洲在线一区二区三区| 国产av一二三区在线观看| 高潮少妇高潮久久精品99| 国产精品香蕉一级免费| 欧美日韩精品一区二区三区不卡| 婷婷色香五月综合激激情| 免费观看在线午夜视频| 丰满人妻熟妇乱又乱精品古代| 日韩在线视频精品中文字幕| 国产又大又猛又粗又长又爽| 日韩aa一区二区三区| 妻子的新妈妈中文字幕| 草草视频福利在线观看| 国产精品白丝一区二区| 亚洲国产欧美精品久久| 亚洲日本久久国产精品久久| 国产一区二区精品高清免费| 熟女乱一区二区三区四区| 色婷婷在线精品国自产拍| 久草精品视频精品视频精品| 欧美成人久久久免费播放| 在线免费视频你懂的观看| 亚洲中文字幕免费人妻| 国产精品欧美一级免费| 高清一区二区三区不卡免费| 精品国产一区二区欧美| 日本人妻丰满熟妇久久| 国产av熟女一区二区三区四区|