本文整理汇总了Java中android.support.v7.app.AppCompatDialog.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java AppCompatDialog.setTitle方法的具体用法?Java AppCompatDialog.setTitle怎么用?Java AppCompatDialog.setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.app.AppCompatDialog
的用法示例。
在下文中一共展示了AppCompatDialog.setTitle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: rescan
import android.support.v7.app.AppCompatDialog; //导入方法依赖的package包/类
private void rescan(){
ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if (mWifi.isConnected() && mWifi.isAvailable()){
AppCompatDialog dialog = new AppCompatDialog(this);
dialog.setTitle(R.string.scanning);
dialog.setCancelable(false);
dialog.show();
AsyncScan scan = new AsyncScan(dialog, getString(R.string.scanning_your_network));
scan.execute(adapter);
}else {
Toast.makeText(this, getString(R.string.not_connected_error), Toast.LENGTH_LONG).show();
}
}
示例3: 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();
}
示例4: onCreateDialog
import android.support.v7.app.AppCompatDialog; //导入方法依赖的package包/类
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) {
AppCompatDialog dialog = new AppCompatDialog(getActivity(), getTheme());
dialog.setTitle(R.string.menu_statistics);
return dialog;
}