本文整理匯總了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();
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}