本文整理汇总了Java中android.view.Window.setDimAmount方法的典型用法代码示例。如果您正苦于以下问题:Java Window.setDimAmount方法的具体用法?Java Window.setDimAmount怎么用?Java Window.setDimAmount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.Window
的用法示例。
在下文中一共展示了Window.setDimAmount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import android.view.Window; //导入方法依赖的package包/类
/**
* DialogLoading loading = new DialogLoading(context)
* loading.show("123")
*
* @param msg 消息
*/
public AlertDialog show(String msg) {
alertDialog = new AlertDialog.Builder(mContext).create();
alertDialog.show();
Window window = alertDialog.getWindow();
window.setContentView(R.layout.dialog_loading);
window.setGravity(Gravity.CENTER);// 此处可以设置dialog显示的位置
//window.setWindowAnimations(R.style.DialogAnimation);
window.setBackgroundDrawableResource(R.color.transparent);
window.setDimAmount(0f);//覆盖成透明度
this.msg = (TextView) window.findViewById(R.id.textView1);
this.msg.setText(msg);
//alertDialog.setCancelable(false);// 点击退出
return alertDialog;
}
示例2: onStart
import android.view.Window; //导入方法依赖的package包/类
@Override
public void onStart() {
super.onStart();
final Window window = getDialog().getWindow();
if (window != null) {
window.setBackgroundDrawableResource(android.R.color.transparent);
window.setDimAmount(0f);
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
}
}
示例3: initDialogWidth
import android.view.Window; //导入方法依赖的package包/类
private void initDialogWidth() {
Window window = getWindow();
if (window == null) {
return;
}
window.setDimAmount(0.6f); // 部分刷机会导致背景透明,这里保证一次
WindowManager.LayoutParams wmlp = window.getAttributes();
wmlp.width = ViewGroup.LayoutParams.MATCH_PARENT;
window.setAttributes(wmlp);
}
示例4: setTransParentBackground
import android.view.Window; //导入方法依赖的package包/类
/**
* 背景全透明
*/
public <T extends BubbleDialog> T setTransParentBackground()
{
Window window = getWindow();
if (window == null) return (T) this;
window.setDimAmount(0);
return (T) this;
}
示例5: onCreateDialog
import android.view.Window; //导入方法依赖的package包/类
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.setCancelable(false);
setCancelable(false);
Window window = dialog.getWindow();
if (window != null) {
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
window.setDimAmount(0);
}
return dialog;
}
示例6: BaseMessageDialog
import android.view.Window; //导入方法依赖的package包/类
protected BaseMessageDialog(Activity activity, boolean fullscreen, BaseMessageOptions options,
WebInterstitialOptions webOptions, HTMLOptions htmlOptions) {
super(activity, getTheme(activity));
SizeUtil.init(activity);
this.activity = activity;
this.options = options;
this.webOptions = webOptions;
this.htmlOptions = htmlOptions;
if (webOptions != null) {
isWeb = true;
}
if (htmlOptions != null) {
isHtml = true;
}
dialogView = new RelativeLayout(activity);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
dialogView.setBackgroundColor(Color.TRANSPARENT);
dialogView.setLayoutParams(layoutParams);
RelativeLayout view = createContainerView(activity, fullscreen);
view.setId(108);
dialogView.addView(view, view.getLayoutParams());
if ((!isWeb || (webOptions != null && webOptions.hasDismissButton())) && !isHtml) {
CloseButton closeButton = createCloseButton(activity, fullscreen, view);
dialogView.addView(closeButton, closeButton.getLayoutParams());
}
setContentView(dialogView, dialogView.getLayoutParams());
dialogView.setAnimation(createFadeInAnimation());
if (!fullscreen) {
Window window = getWindow();
if (window == null) {
return;
}
if (!isHtml) {
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
if (Build.VERSION.SDK_INT >= 14) {
window.setDimAmount(0.7f);
}
} else {
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
if (htmlOptions != null &&
MessageTemplates.Args.HTML_ALIGN_BOTTOM.equals(htmlOptions.getHtmlAlign())) {
dialogView.setGravity(Gravity.BOTTOM);
}
}
}
}