本文整理汇总了Java中android.support.v7.app.AlertDialog.findViewById方法的典型用法代码示例。如果您正苦于以下问题:Java AlertDialog.findViewById方法的具体用法?Java AlertDialog.findViewById怎么用?Java AlertDialog.findViewById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.app.AlertDialog
的用法示例。
在下文中一共展示了AlertDialog.findViewById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findMatch
import android.support.v7.app.AlertDialog; //导入方法依赖的package包/类
public void findMatch() {
SharedPreferences preferences = getSharedPreferences("PREFS", 0);
String[] fileNameList = preferences.getString("fileNameList", "").split(" ");
double maxRatio = 0;
String bestFileName = null;
for (String fileName : fileNameList) {
double ratio = matchFeaturesFile(fileName);
if (ratio > maxRatio) {
maxRatio = ratio;
bestFileName = fileName;
}
}
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Match found");
builder.setMessage(String.format("%s: %s%%", bestFileName, (int) (maxRatio * 100)));
builder.setPositiveButton("OK", null);
AlertDialog dialog = builder.show();
// Must call show() prior to fetching text view
TextView messageView = (TextView)dialog.findViewById(android.R.id.message);
messageView.setGravity(Gravity.CENTER);
}
示例2: init
import android.support.v7.app.AlertDialog; //导入方法依赖的package包/类
@Override
protected void init(Bundle savedInstanceState) {
super.init(savedInstanceState);
final AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle(R.string.crash_dialog_title)
.setView(R.layout.crash_report_dialog)
.setPositiveButton(R.string.ok, this)
.setNegativeButton(R.string.cancel, this)
.create();
dialog.setCanceledOnTouchOutside(false);
dialog.setOnDismissListener(this);
dialog.show();
comment = (EditText) dialog.findViewById(android.R.id.input);
if (savedInstanceState != null) {
comment.setText(savedInstanceState.getString(STATE_COMMENT));
}
}
示例3: onCreateDialog
import android.support.v7.app.AlertDialog; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final File file = (File) getArguments().getSerializable(EXTRA_FILEPATH);
LayoutInflater inflater = LayoutInflater.from(getActivity());
AlertDialog.Builder dialogBuilder = setUpDialog(file, inflater);
AlertDialog dialog = dialogBuilder.show();
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
_newNameField = dialog.findViewById(R.id.new_name);
return dialog;
}
示例4: showFileInfo
import android.support.v7.app.AlertDialog; //导入方法依赖的package包/类
/**
* show dialog with file info
* filePath, path, size, extension ...
*
* @param file - file to show info
*/
private void showFileInfo(File file) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(file.getName());
builder.setView(R.layout.dialog_view_file);
AlertDialog dialog = builder.create();
dialog.show();
TextView txtInfo = dialog.findViewById(R.id.txt_info);
txtInfo.setText(file.getPath() + "\n" +
file.length() + " byte");
EditorView editorView = dialog.findViewById(R.id.editor_view);
if (editorView != null && FileUtils.canEdit(file)) {
editorView.setTextHighlighted(mFileManager.fileToString(file));
}
}
示例5: showDialogAbout
import android.support.v7.app.AlertDialog; //导入方法依赖的package包/类
private void showDialogAbout() {
final SpannableString m = new SpannableString(getString(R.string.dialog_about_text));
Linkify.addLinks(m, Linkify.WEB_URLS);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.title_about);
builder.setMessage(m);
builder.setPositiveButton(R.string.dialog_ok, null);
AlertDialog alertDialog = builder.show();
TextView textView = alertDialog.findViewById(android.R.id.message);
if (textView != null) {
textView.setMovementMethod(LinkMovementMethod.getInstance());
}
}