當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。