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


Java AppCompatDialog.setContentView方法代码示例

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


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

示例1: showLoading

import android.support.v7.app.AppCompatDialog; //导入方法依赖的package包/类
public static void showLoading(Context context, String type) {

        final AppCompatDialog dialog = new AppCompatDialog(context, R.style.dialog);

        final AVLoadingIndicatorView avLoadingIndicatorView = LoaderCreator.create(context, type);
        dialog.setContentView(avLoadingIndicatorView);

        int deviceWidth = DimenUtil.getScreenWidth();
        int deviceHeight = DimenUtil.getScreenHeight();

        final Window dialogWindow = dialog.getWindow();
        if (dialog != null) {
            final WindowManager.LayoutParams lp = dialogWindow.getAttributes();
            lp.width = deviceWidth / LOADER_SIZE_SCALE;
            lp.height = deviceHeight / LOADER_SIZE_SCALE;
            lp.height = lp.height + deviceHeight / LOADER_OFFSET_SCALE;
            lp.gravity = Gravity.CENTER;
        }

        LOADERS.add(dialog);
        dialog.show();
    }
 
开发者ID:remerber,项目名称:FastEc,代码行数:23,代码来源:LatteLoader.java

示例2: showLoading

import android.support.v7.app.AppCompatDialog; //导入方法依赖的package包/类
private static void showLoading(Context context, String type) {

        final AppCompatDialog dialog = new AppCompatDialog(context, R.style.dialog);

        final AVLoadingIndicatorView avLoadingIndicatorView = LoaderCreator.create(type, context);
        dialog.setContentView(avLoadingIndicatorView);

        int deviceWidth = DimenUtil.getScreenWidth();
        int deviceHeight = DimenUtil.getScreenHeight();

        final Window dialogWindow = dialog.getWindow();

        if (dialogWindow != null) {
            final WindowManager.LayoutParams lp = dialogWindow.getAttributes();
            lp.width = deviceWidth / LOADER_SIZE_SCALE;
            lp.height = deviceHeight / LOADER_SIZE_SCALE;
            lp.height = lp.height + deviceHeight / LOADER_OFFSET_SCALE;
            lp.gravity = Gravity.CENTER;
        }
        LOADERS.add(dialog);
        dialog.show();
    }
 
开发者ID:organizationAllink,项目名称:wzyx-android-user,代码行数:23,代码来源:WzyxLoader.java

示例3: showProgressbar

import android.support.v7.app.AppCompatDialog; //导入方法依赖的package包/类
public AppCompatDialog showProgressbar(Activity activity, long timeout, boolean cancelable) {
    final AppCompatDialog dialog = new AppCompatDialog(activity);
    dialog.setContentView(R.layout.dialog_progress);
    dialog.setCancelable(cancelable);
    dialog.setTitle("Progressing...");
    ProgressBar progressBar = (ProgressBar) dialog.findViewById(R.id.progress);
    if (timeout > 0) {
        Handler handler = new Handler(activity.getMainLooper());
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                dialog.cancel();
                dialog.dismiss();
            }
        }, timeout);
        dialog.show();
    } else {
        dialog.show();
    }
    return dialog;
}
 
开发者ID:PuffOpenSource,项目名称:Puff-Android,代码行数:22,代码来源:ResUtil.java

示例4: showDialog

import android.support.v7.app.AppCompatDialog; //导入方法依赖的package包/类
private void showDialog() {
        // AlertDialog dialog = new AlertDialog(this);
        AppCompatDialog dialog = new AppCompatDialog(this);
        dialog.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);//key code to remove title
        Window window = dialog.getWindow();
        window.setGravity(Gravity.BOTTOM);
        window.setWindowAnimations(R.style.mystyle);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));//round corner
        // window.setBackgroundDrawableResource(R.drawable.bg_ios_roundcorner);
        // window.requestFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.dialog_ios_alert_bottom);
        // AlertDialog.Builder builder = new AlertDialog.Builder(this);


        // 可以在此设置显示动画
        WindowManager.LayoutParams wl = window.getAttributes();
       /* wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();*/
// 以下这两句是为了保证按钮可以水平满屏
        int width = getWindowManager().getDefaultDisplay().getWidth();

        // wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.width = (int) (width * 0.85);  // todo keycode gap
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        //wl.horizontalMargin= 0.2f;
// 设置显示位置
        // wl.gravity = Gravity.CENTER_HORIZONTAL;

        dialog.onWindowAttributesChanged(wl);
        dialog.show();
    }
 
开发者ID:glassLake,项目名称:DialogUtils,代码行数:32,代码来源:MainActivity.java

示例5: onCreateDialog

import android.support.v7.app.AppCompatDialog; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AppCompatDialog dialog = new AppCompatDialog(attachActivity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);

    root = View.inflate(attachActivity, R.layout.dialog_discover_qrcode, null);
    dialog.setContentView(root);

    initViewAndData();
    return dialog;
}
 
开发者ID:maxwell-nc,项目名称:ExhibitionCenter,代码行数:13,代码来源:QRCodeDialogFragment.java

示例6: create

import android.support.v7.app.AppCompatDialog; //导入方法依赖的package包/类
@Override
public @NonNull Dialog create(Context context, ExampleDialogFragment fragment) {
    String[] urls = context.getResources().getStringArray(R.array.octocat_urls);
    AppCompatDialog dialog = new AppCompatDialog(context);
    dialog.setContentView(R.layout.dialog_custom);
    Glide.with(fragment)
            .load(urls[sRandom.nextInt(urls.length)])
            .into((ImageView) dialog.findViewById(R.id.customdialog_image));
    return dialog;
}
 
开发者ID:kakajika,项目名称:SwipeAwayDialog,代码行数:11,代码来源:ExampleDialogFragment.java

示例7: showWarningDialog

import android.support.v7.app.AppCompatDialog; //导入方法依赖的package包/类
/**
 * Shows the initial warning dialog
 */
void showWarningDialog() {
    final AppCompatDialog d = new AppCompatDialog(this);
    d.setTitle("Warning");
    d.setCancelable(false);
    d.setContentView(R.layout.warningdialog);

    final CheckBox c = (CheckBox) d.findViewById(R.id.c);
    final Button b = (Button) d.findViewById(R.id.b);

    c.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
            b.setText(checked ? android.R.string.ok : android.R.string.cancel);
        }
    });

    b.setText(android.R.string.cancel);
    b.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (c.isChecked()) {
                getSharedPreferences("settings", MODE_PRIVATE).edit()
                        .putBoolean("warningRead", true).commit();
                d.dismiss();
            } else {
                d.dismiss();
                finish();
            }
        }
    });

    d.show();
}
 
开发者ID:j4velin,项目名称:SystemAppMover,代码行数:37,代码来源:MoverActivity.java


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