本文整理了Java中android.app.AlertDialog.findViewById()
方法的一些代码示例,展示了AlertDialog.findViewById()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AlertDialog.findViewById()
方法的具体详情如下:
包路径:android.app.AlertDialog
类名称:AlertDialog
方法名:findViewById
暂无
代码示例来源:origin: stackoverflow.com
// Linkify the message
final SpannableString s = new SpannableString(msg);
Linkify.addLinks(s, Linkify.ALL);
final AlertDialog d = new AlertDialog.Builder(activity)
.setPositiveButton(android.R.string.ok, null)
.setIcon(R.drawable.icon)
.setMessage( s )
.create();
d.show();
// Make the textview clickable. Must be called after show()
((TextView)d.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
代码示例来源:origin: stackoverflow.com
final AlertDialog d = new AlertDialog.Builder(this)
.setPositiveButton(android.R.string.ok, null)
.setIcon(R.drawable.icon)
.setMessage(Html.fromHtml("<a href=\"http://www.google.com\">Check this link out</a>"))
.create();
d.show();
// Make the textview clickable. Must be called after show()
((TextView)d.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
代码示例来源:origin: stackoverflow.com
AlertDialog alert = builder.create();
alert.show();
TextView msgTxt = (TextView) alert.findViewById(android.R.id.message);
msgTxt.setTextSize(16.0);
代码示例来源:origin: stackoverflow.com
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("My Title");
builder.setMessage("your message");
builder.setPositiveButton("OK", null);
AlertDialog dialog = builder.show();
TextView messageText = (TextView)dialog.findViewById(android.R.id.message);
messageText.setGravity(Gravity.CENTER);
dialog.show();
代码示例来源:origin: commonsguy/cw-omnibus
public void onClick(DialogInterface di, int whichButton) {
ContentValues values=new ContentValues(2);
AlertDialog dlg=(AlertDialog)di;
EditText title=(EditText)dlg.findViewById(R.id.title);
EditText value=(EditText)dlg.findViewById(R.id.value);
values.put(DatabaseHelper.TITLE, title.getText().toString());
values.put(DatabaseHelper.VALUE, value.getText().toString());
task=new InsertTask().execute(values);
}
代码示例来源:origin: commonsguy/cw-omnibus
public void onClick(DialogInterface di, int whichButton) {
ContentValues values=new ContentValues(2);
AlertDialog dlg=(AlertDialog)di;
EditText title=(EditText)dlg.findViewById(R.id.title);
EditText value=(EditText)dlg.findViewById(R.id.value);
values.put(DatabaseHelper.TITLE, title.getText().toString());
values.put(DatabaseHelper.VALUE, value.getText().toString());
task=new InsertTask().execute(values);
}
代码示例来源:origin: commonsguy/cw-omnibus
public void onClick(DialogInterface di, int whichButton) {
ContentValues values=new ContentValues(2);
AlertDialog dlg=(AlertDialog)di;
EditText title=dlg.findViewById(R.id.title);
EditText value=dlg.findViewById(R.id.value);
values.put(DatabaseHelper.TITLE, title.getText().toString());
values.put(DatabaseHelper.VALUE, value.getText().toString());
task=new InsertTask().execute(values);
}
代码示例来源:origin: commonsguy/cw-omnibus
public void onClick(DialogInterface di, int whichButton) {
ContentValues values=new ContentValues(2);
AlertDialog dlg=(AlertDialog)di;
EditText title=(EditText)dlg.findViewById(R.id.title);
EditText value=(EditText)dlg.findViewById(R.id.value);
values.put(DatabaseHelper.TITLE, title.getText().toString());
values.put(DatabaseHelper.VALUE, value.getText().toString());
task=new InsertTask().execute(values);
}
代码示例来源:origin: commonsguy/cw-omnibus
public void onClick(DialogInterface di, int whichButton) {
ContentValues values=new ContentValues(2);
AlertDialog dlg=(AlertDialog)di;
EditText title=(EditText)dlg.findViewById(R.id.title);
EditText value=(EditText)dlg.findViewById(R.id.value);
values.put(DatabaseHelper.TITLE, title.getText().toString());
values.put(DatabaseHelper.VALUE, value.getText().toString());
task=new InsertTask().execute(values);
}
代码示例来源:origin: commonsguy/cw-omnibus
public void onClick(DialogInterface di, int whichButton) {
ContentValues values=new ContentValues(2);
AlertDialog dlg=(AlertDialog)di;
EditText title=(EditText)dlg.findViewById(R.id.title);
EditText value=(EditText)dlg.findViewById(R.id.value);
values.put(DatabaseHelper.TITLE, title.getText().toString());
values.put(DatabaseHelper.VALUE, value.getText().toString());
task=new InsertTask().execute(values);
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onClick(DialogInterface dialog, int which) {
ContentValues values=new ContentValues(2);
AlertDialog dlg=(AlertDialog)dialog;
EditText title=(EditText)dlg.findViewById(R.id.title);
EditText value=(EditText)dlg.findViewById(R.id.value);
values.put(DatabaseHelper.TITLE, title.getText().toString());
values.put(DatabaseHelper.VALUE, value.getText().toString());
task=new InsertTask(getActivity()).execute(values);
}
代码示例来源:origin: commonsguy/cw-omnibus
public void onClick(DialogInterface di, int whichButton) {
ContentValues values=new ContentValues(2);
AlertDialog dlg=(AlertDialog)di;
EditText title=dlg.findViewById(R.id.title);
EditText value=dlg.findViewById(R.id.value);
values.put(DatabaseHelper.TITLE, title.getText().toString());
values.put(DatabaseHelper.VALUE, value.getText().toString());
final ContentResolver cr=getActivity().getContentResolver();
new Thread() {
@Override
public void run() {
cr.insert(Provider.Constants.CONTENT_URI, values);
}
}.start();
}
代码示例来源:origin: stackoverflow.com
Button submit = (Button) findViewById(R.id.submitButton);
submit.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(Application1GoodExample.this);
builder.setMessage("Your form has been successfully submitted");
builder.setNegativeButton("Exit", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
// this will solve your error
AlertDialog alert = builder.create();
alert.show();
alert.getWindow().getAttributes();
TextView textView = (TextView) alert.findViewById(android.R.id.message);
textView.setTextSize(40);
Button btn1 = alert.getButton(DialogInterface.BUTTON_NEGATIVE);
btn1.setTextSize(16);
}
});
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldDelegateToDialogFindViewByIdIfViewIsNull() {
AlertDialog dialog = new AlertDialog(context) {};
assertThat((View) dialog.findViewById(99)).isNull();
dialog.setContentView(R.layout.main);
assertNotNull(dialog.findViewById(R.id.title));
}
代码示例来源:origin: 4thline/cling
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
AlertDialog dialog = new AlertDialog.Builder(this).create();
dialog.setTitle(R.string.deviceDetails);
DeviceDisplay deviceDisplay = (DeviceDisplay)l.getItemAtPosition(position);
dialog.setMessage(deviceDisplay.getDetailsMessage());
dialog.setButton(
getString(R.string.OK),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
}
);
dialog.show();
TextView textView = (TextView) dialog.findViewById(android.R.id.message);
textView.setTextSize(12);
super.onListItemClick(l, v, position, id);
}
代码示例来源:origin: stackoverflow.com
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("TEST MESSAGE)
.setPositiveButton("YES", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
.setNegativeButton("NO", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
((Button)alert.findViewById(android.R.id.button1)).setBackgroundResource(R.drawable.button_border);
代码示例来源:origin: stackoverflow.com
public static void colorAlertDialogTitle(AlertDialog dialog, int color) {
int dividerId = dialog.getContext().getResources().getIdentifier("android:id/titleDivider", null, null);
if (dividerId != 0) {
View divider = dialog.findViewById(dividerId);
divider.setBackgroundColor(color);
}
int textViewId = dialog.getContext().getResources().getIdentifier("android:id/alertTitle", null, null);
if (textViewId != 0) {
TextView tv = (TextView) dialog.findViewById(textViewId);
tv.setTextColor(color);
}
int iconId = dialog.getContext().getResources().getIdentifier("android:id/icon", null, null);
if (iconId != 0) {
ImageView icon = (ImageView) dialog.findViewById(iconId);
icon.setColorFilter(color);
}
}
代码示例来源:origin: syncthing/syncthing-android
/**
* Saves current tab index and fragment states.
*/
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
FragmentManager fm = getSupportFragmentManager();
Consumer<Fragment> putFragment = fragment -> {
if (fragment != null && fragment.isAdded()) {
fm.putFragment(outState, fragment.getClass().getName(), fragment);
}
};
putFragment.accept(mFolderListFragment);
putFragment.accept(mDeviceListFragment);
putFragment.accept(mDrawerFragment);
outState.putInt("currentTab", mViewPager.getCurrentItem());
outState.putBoolean(BATTERY_DIALOG_DISMISSED, mBatteryOptimizationsDialog == null || !mBatteryOptimizationsDialog.isShowing());
outState.putBoolean(IS_SHOWING_RESTART_DIALOG, mRestartDialog != null && mRestartDialog.isShowing());
if(mQrCodeDialog != null && mQrCodeDialog.isShowing()) {
outState.putBoolean(IS_QRCODE_DIALOG_DISPLAYED, true);
ImageView qrCode = mQrCodeDialog.findViewById(R.id.qrcode_image_view);
TextView deviceID = mQrCodeDialog.findViewById(R.id.device_id);
outState.putParcelable(QRCODE_BITMAP_KEY, ((BitmapDrawable) qrCode.getDrawable()).getBitmap());
outState.putString(DEVICEID_KEY, deviceID.getText().toString());
}
Util.dismissDialogSafe(mRestartDialog, this);
}
代码示例来源:origin: VREMSoftwareDevelopment/WiFiAnalyzer
@Test
public void testWiFiBandFilterViewIsVisible() {
// setup
fixture.show();
// execute
int actual = alertDialog.findViewById(R.id.filterWiFiBand).getVisibility();
// validate
assertEquals(View.VISIBLE, actual);
}
代码示例来源:origin: VREMSoftwareDevelopment/WiFiAnalyzer
@Test
public void testStrengthFilterViewIsVisible() {
// setup
fixture.show();
// execute
int actual = alertDialog.findViewById(R.id.filterStrength).getVisibility();
// validate
assertEquals(View.VISIBLE, actual);
}
}
内容来源于网络,如有侵权,请联系作者删除!