当前位置: 首页>>代码示例>>Java>>正文


Java AlertDialog.getWindow方法代码示例

本文整理汇总了Java中android.app.AlertDialog.getWindow方法的典型用法代码示例。如果您正苦于以下问题:Java AlertDialog.getWindow方法的具体用法?Java AlertDialog.getWindow怎么用?Java AlertDialog.getWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.AlertDialog的用法示例。


在下文中一共展示了AlertDialog.getWindow方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showOptionDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
private void showOptionDialog(final AlertDialog dialog) {
    final IBinder windowToken = mKeyboardSwitcher.getMainKeyboardView().getWindowToken();
    if (windowToken == null) {
        return;
    }

    final Window window = dialog.getWindow();
    final WindowManager.LayoutParams lp = window.getAttributes();
    lp.token = windowToken;
    lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
    window.setAttributes(lp);
    window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

    mOptionsDialog = dialog;
    dialog.show();
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:17,代码来源:LatinIME.java

示例2: buildBottomDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
public static AlertDialog buildBottomDialog(Activity activity, View contentView) {
    AlertDialog dialog = new Builder(activity).create();
    dialog.setCanceledOnTouchOutside(true);
    dialog.show();
    dialog.setContentView(contentView);
    Window dialogWindow = dialog.getWindow();
    Display d = activity.getWindowManager().getDefaultDisplay();
    LayoutParams p = dialogWindow.getAttributes();
    p.width = d.getWidth();
    dialogWindow.setAttributes(p);
    dialogWindow.setGravity(80);
    return dialog;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:14,代码来源:DialogUtils.java

示例3: onCreate

import android.app.AlertDialog; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_clock);

	Intent intent = getIntent();
	// ��ȡ�������
	String contentValue = intent.getStringExtra("content");
	String alarmValue = intent.getStringExtra("alarmtime");

	mp = MediaPlayer.create(ClockActivity.this, R.raw.alarm);// ����mediaplayer����
	mp.start();// ��ʼ����

	AlertDialog alertDialog = new AlertDialog.Builder(ClockActivity.this)
			.create();
	alertDialog.setCancelable(false); // ���öԻ�������ĵط��ͷ��ؼ�.
	alertDialog.show();
	Window window = alertDialog.getWindow();// �Զ���AlertDialog��ʽ
	window.setContentView(R.layout.clock);
	TextView tv_time = (TextView) window.findViewById(R.id.clocktime); // ��ʾʱ��
	tv_time.setText(alarmValue);
	TextView tv_message = (TextView) window.findViewById(R.id.clockcontent); // ��ʾ����
	tv_message.setText(contentValue);
	Button clockbutton = (Button) window.findViewById(R.id.btn_clock);// ȡ�����Ӱ�ť
	clockbutton.setOnClickListener(new OnClickListener() {

		@Override
		public void onClick(View v) {
			mp.stop();
			mp.reset();
			ClockActivity.this.finish();
		}
	});
}
 
开发者ID:z9961,项目名称:DoList,代码行数:35,代码来源:ClockActivity.java

示例4: onCreate

import android.app.AlertDialog; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_clock);

	Intent intent = getIntent();
	// 获取相关数据
	String contentValue = intent.getStringExtra("content");
	String alarmValue = intent.getStringExtra("alarmtime");

	mp = MediaPlayer.create(FestivalClockActivity.this, R.raw.alarm);// 创建mediaplayer对象
	mp.start();

	String Message = alarmValue + "\n" + contentValue; // 传入节日

	AlertDialog alertDialog = new AlertDialog.Builder(
			FestivalClockActivity.this).create();
	alertDialog.setCancelable(false); // 禁用对话框以外的地方和返回键.
	alertDialog.show();
	Window window = alertDialog.getWindow();// 自定义AlertDialog样式
	window.setContentView(R.layout.clock);
	TextView tv_time = (TextView) window.findViewById(R.id.clocktime); // 显示时间
	tv_time.setText(alarmValue);
	TextView tv_message = (TextView) window.findViewById(R.id.clockcontent); // 显示内容
	tv_message.setText(contentValue);
	Button clockbutton = (Button) window.findViewById(R.id.btn_clock);// 取消闹钟按钮
	clockbutton.setOnClickListener(new OnClickListener() {

		@Override
		public void onClick(View v) {
			mp.stop();
			mp.reset();
			FestivalClockActivity.this.finish();
		}
	});
}
 
开发者ID:z9961,项目名称:DoList,代码行数:37,代码来源:FestivalClockActivity.java

示例5: alterDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
public static AlertDialog alterDialog(Context context,View view){
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setView(view);
    AlertDialog dialog = builder.show();
    dialog.setCancelable(false);
    Window window=dialog.getWindow();
    window.setGravity(Gravity.CENTER);
    window.setWindowAnimations(R.style.popwinAnim);
    return dialog;
}
 
开发者ID:dufangyu1990,项目名称:JKApp,代码行数:11,代码来源:Util.java

示例6: showDialogEdit

import android.app.AlertDialog; //导入方法依赖的package包/类
/**
 * 显示输入框
 */
public void showDialogEdit(Context context) {
    final AlertDialog dialog;
    AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogTransBackGround);
    dialog = builder.create();
    dialog.setCancelable(true);
    dialog.show();
    Window window = dialog.getWindow();
    window.setWindowAnimations(R.style.AnimBottom);
    window.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.create_tip_dialog_layout, null);
    dialog.setContentView(view_dialog);
    ((TextView)view_dialog.findViewById(R.id.edt_create_layout_input)).setText("退出当前账号?");

    TextView bt_yes = (TextView) view_dialog.findViewById(R.id.set);
    TextView bt_no = (TextView) view_dialog.findViewById(R.id.cancel);

    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            logout();
            dialog.dismiss();
        }
    });
    bt_no.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:34,代码来源:SettingActivity.java

示例7: showDialogEdit

import android.app.AlertDialog; //导入方法依赖的package包/类
/**
     * 显示输入框
     */
    public void showDialogEdit(Context context) {
        final AlertDialog dialog;
        AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogTransBackGround);
        dialog = builder.create();
        dialog.setCancelable(true);
        dialog.show();
        Window window = dialog.getWindow();
        window.setWindowAnimations(R.style.AnimBottom);
        window.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        View view_dialog = LayoutInflater.from(context).inflate(R.layout.create_tip_dialog_layout, null);
        ((TextView) view_dialog.findViewById(R.id.edt_create_layout_input)).setText("退出app?");
        dialog.setContentView(view_dialog);

        TextView bt_yes = (TextView) view_dialog.findViewById(R.id.set);
        TextView bt_no = (TextView) view_dialog.findViewById(R.id.cancel);

        bt_yes.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                logout();
                dialog.dismiss();
                ActivityManagerUtil.getInstance().finishAllActivity();

            }
        });
        bt_no.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dialog.dismiss();
            }
        });
    }
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:36,代码来源:MainActivity.java

示例8: showDialogEdit

import android.app.AlertDialog; //导入方法依赖的package包/类
/**
 * 显示输入框
 */
public static void showDialogEdit(Context context, final TextView textView) {
    final AlertDialog dialog;
    AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogTransBackGround);
    dialog = builder.create();
    dialog.setCancelable(true);
    dialog.show();
    Window window = dialog.getWindow();
    window.setWindowAnimations(R.style.AnimBottom);
    window.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.create_ac_input_layout, null);
    dialog.setContentView(view_dialog);

    final EditText et_content = (EditText) view_dialog.findViewById(R.id.edt_create_layout_input);
    TextView bt_yes = (TextView) view_dialog.findViewById(R.id.set);
    TextView bt_no = (TextView) view_dialog.findViewById(R.id.cancel);

    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String content = et_content.getText().toString().trim();
            AppUtils.hintKbTwo(et_content);
            if (!content.isEmpty()) {
                textView.setText(content);
                dialog.dismiss();
            }
        }
    });
    bt_no.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            AppUtils.hintKbTwo(et_content);
            dialog.dismiss();
        }
    });
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:39,代码来源:DialogUtils.java


注:本文中的android.app.AlertDialog.getWindow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。