Refine search
Dialog dialog = new Dialog(Activity.this); dialog.setContentView(R.layout.list) ListView lv = (ListView ) dialog.findViewById(R.id.lv); dialog.setCancelable(true); dialog.setTitle("ListView"); dialog.show();
Dialog dialog = new Dialog(this,R.style.ThemeDialogCustom); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); //you can move the dialog, so that is not centered // dialog.getWindow().getAttributes().y = 50; //50 should be based on density dialog.setContentView(yourLinearLayout); dialog.setCancelable(true); //dialog.setOnCancelListener(cancelListener); dialog.show();
Dialog mOverlayDialog = new Dialog(mContext, android.R.style.Theme_Panel); //display an invisible overlay dialog to prevent user interaction and pressing back mOverlayDialog.setCancelable(false); mOverlayDialog.show();
final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.alert_dialog); Button okBtn = (Button) dialog.findViewById(R.id.ok_btn); Button cancelBtn = (Button) dialog.findViewById(R.id.cancel_btn); okBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { doErase(); } }); cancelBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); dialog.setCancelable(false); dialog.show();
private Dialog dialog() { Dialog diUnit = new Dialog(Overzicht.this); LayoutInflater inflater = (LayoutInflater) getLayoutInflater(); View content = inflater.inflate(R.layout.unitdialog, null); diUnit.setContentView(content); EditText etKM = (EditText) content.findViewById(R.id.etKM); etKM.setInputType(InputType.TYPE_CLASS_NUMBER); diUnit.setTitle("Add unit"); diUnit.setCancelable(false); diUnit.getWindow().getAttributes().width = LayoutParams.FILL_PARENT; bUnitDialogSave = (Button) diUnit.findViewById(R.id.bUnitDialogVoegToe); bUnitDialogCancel = (Button) diUnit.findViewById(R.id.bUnitDialogCancel); bUnitDialogCancel.setOnClickListener(this); bUnitDialogAdd.setOnClickListener(this); return diUnit;
final Dialog yourDialog = new Dialog(YourClass.this); yourDialog.requestWindowFeature(Window.FEATURE_LEFT_ICON); //must come BEFORE setContentView yourDialog.setContentView(R.layout.yourDialog_layout); yourDialog.setTitle("Your Title"); yourDialog.setCancelable(true); yourDialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.your_icon); //must come AFTER setContentView
public class ViewDialog { public void showDialog(Activity activity, String msg){ final Dialog dialog = new Dialog(activity); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(false); dialog.setContentView(R.layout.dialog); TextView text = (TextView) dialog.findViewById(R.id.text_dialog); text.setText(msg); Button dialogButton = (Button) dialog.findViewById(R.id.btn_dialog); dialogButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } }
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Dialog overlayInfo = new Dialog(MainActivity.this); // Making sure there's no title. overlayInfo.requestWindowFeature(Window.FEATURE_NO_TITLE); // Making dialog content transparent. overlayInfo.getWindow().setBackgroundDrawable( new ColorDrawable(Color.TRANSPARENT)); // Removing window dim normally visible when dialog are shown. overlayInfo.getWindow().clearFlags( WindowManager.LayoutParams.FLAG_DIM_BEHIND); // Setting position of content, relative to window. WindowManager.LayoutParams params = overlayInfo.getWindow().getAttributes(); params.gravity = Gravity.TOP | Gravity.LEFT; params.x = 100; params.y = 20; // If user taps anywhere on the screen, dialog will be cancelled. overlayInfo.setCancelable(true); // Setting the content using prepared XML layout file. overlayInfo.setContentView(R.layout.info_overlay); overlayInfo.show(); }
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); LayoutInflater inflater = getLayoutInflater(); View dialogView = inflater.inflate(R.layout.your_custom_dialog_xml, null); dialogBuilder.setView(dialogView); final Dialog dialog = dialogBuilder.create(); dialog.setCancelable(false); dialog.show();
dialog.setContentView(R.layout.pop_up_new_contact);//loads the layout we have already create pop_up_new_contact.xml dialog.setCancelable(true);//close the dialog box when the back key is pushed. ImageView x1_button = (ImageView)dialog.findViewById(R.id.x1_button);
Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON); dialog.setContentView(R.layout.dialog); dialog.setTitle("My great title"); dialog.setCancelable(true); dialog.show(); dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.icon); WebView vw = (WebView) dialog.findViewById(R.id.wv);
> final Dialog contacts_dialog = new Dialog(ActivityGroup.this, > R.style.theme_sms_receive_dialog); > contacts_dialog.setContentView(R.layout.dialog_schedule_date_time); > getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT); > contacts_dialog.setCancelable(true); > contacts_dialog.setCanceledOnTouchOutside(true); > contacts_dialog.show();
public void messageDialog(String title, String message, final Context activity) { final Dialog myDialog = new Dialog(activity); myDialog.setContentView(R.layout.messagescreen); myDialog.setTitle(title); myDialog.setCancelable(false); TextView text = (TextView) myDialog.findViewById(R.id.bidmessage); text.setMovementMethod(ScrollingMovementMethod.getInstance()); text.setText(message); Button login = (Button) myDialog.findViewById(R.id.buttonlogin); login.setOnClickListener(new OnClickListener() { public void onClick(View v) { myDialog.dismiss(); } }); Button createAccount= (Button) myDialog.findViewById(R.id.buttoncreateaccount); createAccount.setOnClickListener(new OnClickListener() { public void onClick(View v) { myDialog.dismiss(); } }); myDialog.show(); }
private void showPictureialog() { final Dialog dialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar); // Setting dialogview Window window = dialog.getWindow(); window.setGravity(Gravity.CENTER); window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); dialog.setTitle(null); dialog.setContentView(R.layout.selectpic_dialog); dialog.setCancelable(true); dialog.show(); }
dialog.setContentView(R.layout.select_dialog_singlechoice); dialog.setTitle("Your Widget Name"); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); TextView text = (TextView) dialog.findViewById(R.id.text1); text.setText("Message"); dialog.show();
Dialog cusDialog; cusDialog = new Dialog(MyTestClass.this, R.style.CustomDialog); cusDialog.setContentView(R.layout.dialog_layout_pro); cusDialog.setCancelable(false); cusDialog.show(); }
Dialog dialog = new Dialog(context,R.style.LoadingDialogTheme); dialog.setContentView(R.layout.loading); dialog.setCancelable(false); dialog.show(); dialog.findViewById(R.id.loading_icon).startAnimation(AnimationUtils.loadAnimation(InitActivity.this, R.anim.rotate360)); }
Dialog dialog = new Dialog(MainAppActivity.this, R.style.PauseDialog); dialog.setContentView(R.layout.prompt); dialog.setCancelable(true); dialog.show();
{ Dialog cusDialog; cusDialog = new Dialog(MyTestClass.this, R.style.CustomDialog); cusDialog.setContentView(R.layout.dialog_layout_pro); TextView text = (TextView) cusDialog.findViewById(R.id.tv_dialog); text.setText("here your counter value"); cusDialog.setCancelable(false); cusDialog.show(); }
final Dialog nagDialog = new Dialog(MyActivity.this,android.R.style.Theme_Translucent_NoTitleBar); nagDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); nagDialog.setCancelable(true); nagDialog.setContentView(R.layout.temp); nagDialog.show();