本文整理汇总了Java中android.app.AlertDialog.Builder.setView方法的典型用法代码示例。如果您正苦于以下问题:Java Builder.setView方法的具体用法?Java Builder.setView怎么用?Java Builder.setView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.AlertDialog.Builder
的用法示例。
在下文中一共展示了Builder.setView方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
public void show(String searchName,ArrayList<String> filePathList){
// タイトル
String strTitle = searchName+"駅を検索";
// リストビュー
ListView listview = new ListView( m_parent );
listview.setScrollingCacheEnabled( false );
listview.setOnItemClickListener( this );
// ファイルリスト
List<FileInfo> listFileInfo = new ArrayList<>();
for( String filePath : filePathList ){
File file=new File(filePath);
if(!file.exists()){
continue;
}
System.out.println(filePath);
if(file.getName().endsWith(".oud")||file.getName().endsWith(".oud2")) {
String[] stationName=loadStartEndStation(file);
listFileInfo.add(new FileInfo(stationName[0]+"~"+stationName[1]+"\n"+file.getName(),file));
}
}
Collections.sort( listFileInfo );
m_fileinfoarrayadapter = new FileInfoArrayAdapter( m_parent, listFileInfo );
listview.setAdapter( m_fileinfoarrayadapter );
Builder builder = new AlertDialog.Builder( m_parent );
builder.setTitle( strTitle );
builder.setNeutralButton("キャンセル", null );
builder.setView( listview );
m_dlg = builder.show();
}
示例2: onCreateDialog
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
protected Dialog onCreateDialog(int id) {
if (id == 0) {
Builder builder = new AlertDialog.Builder(this).setIcon(R.drawable.ic_dialog_menu_generic).setTitle(
R.string.pref_about);
View view = getLayoutInflater().inflate(R.layout.about, null);
TextView info = (TextView) view.findViewById(R.id.about_info);
info.setText(Html.fromHtml(getString(R.string.about_info, getVersionNumber(this))));
builder.setView(view);
builder.setNegativeButton(R.string.btn_close, new OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
return builder.create();
}
return null;
}
示例3: showDialog
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
private void showDialog() {
Builder builder = new Builder(this.mContext);
TextView title = new TextView(this.mContext);
title.setText("分享失败原因");
title.setPadding(0, 20, 0, 20);
title.setTextColor(-1);
title.setGravity(17);
title.setTextSize(16.0f);
builder.setCustomTitle(title);
TextView textView = new TextView(this.mContext);
textView.setText("请添加QQ平台到SDK \n添加方式:\nUMQQSsoHandler qqSsoHandler = new UMQQSsoHandler" +
"(getActivity(), \"你的APP ID\",\"你的APP KEY\");\nqqSsoHandler.addToSocialSDK(); " +
"\n参考文档:\nhttp://dev.umeng" +
".com/social/android/share/quick-integration#social_qq_sso");
textView.setTextColor(-1);
textView.setTextSize(16.0f);
textView.setAutoLinkMask(1);
builder.setView(textView);
builder.show().show();
}
示例4: showAlert
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
public static AlertDialog showAlert(final Context context, final String title, final View view, final String ok, final String cancel, final DialogInterface.OnClickListener lOk,
final DialogInterface.OnClickListener lCancel) {
if (context instanceof Activity && ((Activity) context).isFinishing()) {
return null;
}
final Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title);
builder.setView(view);
builder.setPositiveButton(ok, lOk);
builder.setNegativeButton(cancel, lCancel);
// builder.setCancelable(false);
final AlertDialog alert = builder.create();
alert.show();
return alert;
}
示例5: onPrepareDialogBuilder
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onPrepareDialogBuilder(Builder builder) {
Context context = getContext();
ViewGroup.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mValue = getPersistedInt(DEFAULT_VALUE);
LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setLayoutParams(params);
mValueText = new TextView(context);
mValueText.setGravity(Gravity.RIGHT);
mValueText.setPadding(20, 0, 20, 0);
layout.addView(mValueText);
SeekBar seekBar = new SeekBar(context);
seekBar.setPadding(20, 0, 20, 20);
seekBar.setLayoutParams(params);
seekBar.setMax(1000);
seekBar.setProgress((int) (Math.pow((float) (mValue - MIN) / (MAX - MIN), 0.25f) * 1000));
seekBar.setOnSeekBarChangeListener(this);
layout.addView(seekBar);
updateText();
builder.setView(layout);
}
示例6: onPrepareDialogBuilder
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onPrepareDialogBuilder(Builder builder) {
Context context = getContext();
ViewGroup.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mValue = getPersistedInt(95);
LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setLayoutParams(params);
mValueText = new TextView(context);
mValueText.setGravity(Gravity.RIGHT);
mValueText.setPadding(20, 0, 20, 0);
mValueText.setText(getSummary(-mValue));
layout.addView(mValueText);
SeekBar seekBar = new SeekBar(context);
seekBar.setPadding(20, 0, 20, 20);
seekBar.setLayoutParams(params);
seekBar.setMax(150);
seekBar.setProgress(mValue);
seekBar.setOnSeekBarChangeListener(this);
layout.addView(seekBar);
builder.setView(layout);
}
示例7: onClick
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
@Override
public void onClick() {
if(getOnPreferenceClickListener()==null){
mCurrentDirectory =new File("/");
final EditText ed = new EditText(getContext());
ed.setText(getSharedPreferences().getString(getKey(), defaultBlocklist));
Builder b = new Builder(getContext());
b.setTitle(R.string.torrent_blocklist_url);
b.setView(ed);
b.setNegativeButton(android.R.string.cancel, null);
b.setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if(ed.getText().toString().isEmpty()){
showErrorDialog(getErrorString(-3));
return;
}
//trying to download
Uri uri = Uri.parse(ed.getText().toString());
String path = "";
String query = "";
try {
if(uri.getPath()!=null)
path= URLEncoder.encode(uri.getPath(), "UTF-8").replace("+", "%20").replace("%2F", "/");
if(uri.getQuery()!=null){
for(String param : uri.getQueryParameterNames()){
if(!query.isEmpty())
query+="&";
query+=URLEncoder.encode(param, "UTF-8")+"=";
query+=uri.getQueryParameter(param);
}
}
} catch (UnsupportedEncodingException e) {
return;
}
startDownload(uri.getScheme()+"://"+uri.getHost()+path+(!query.isEmpty()?"?"+query:""));
}
});
od =b.create();
od.show();
}
}