Dialog alertDialog = new Dialog(this); alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); alertDialog.setContentView(R.layout.tabs); alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); alertDialog.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 dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.custom_dialog);
public void showImage() { Dialog builder = new Dialog(this); builder.requestWindowFeature(Window.FEATURE_NO_TITLE); builder.getWindow().setBackgroundDrawable( new ColorDrawable(android.graphics.Color.TRANSPARENT)); builder.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialogInterface) { //nothing; } }); ImageView imageView = new ImageView(this); imageView.setImageURI(imageUri); builder.addContentView(imageView, new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); builder.show(); }
Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_login); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
Dialog dialog = new Dialog(this); dialog.requestWindowFeature(dialog.getWindow().FEATURE_NO_TITLE);
final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); dialog.setContentView(R.layout.splash); dialog.show();
Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON); dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.your_icon); dialog.setContentView(R.layout.custom_dialog); dialog.setTitle("Dialog Title"); dialog.show();
Dialog alert = new Dialog(this); alert.requestWindowFeature(Window.FEATURE_NO_TITLE); alert.setContentView(R.layout.title); TextView msg = (TextView)alert.findViewById(R.id.textView1); msg.setText("Hello Friends.\nIP address : 111.111.1.111"); alert.show();
Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON); dialog.setContentView(R.layout.custom_dialog); dialog.setTitle("Dialog Title"); dialog.show(); dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.your_icon);
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(); } }
final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON); dialog.setTitle(R.string.my_dialog_title); dialog.setContentView(R.layout.my_dialog_layout); dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.some_icon); dialog.show();
public void onCoachMark(){ final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); dialog.setContentView(R.layout.coach_mark); dialog.setCanceledOnTouchOutside(true); //for dismissing anywhere you touch View masterView = dialog.findViewById(R.id.coach_mark_master_view); masterView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); dialog.show(); }
Dialog dialog = new Dialog(activity.this, android.R.style.Theme_Translucent_NoTitleBar); // your layout file dialog.setContentView(R.layout.dialog); // for hide title dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); //for set title dialog.setTitle("Custom Dialog"); 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(); }
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 dialog = new Dialog(context); dialog.getWindow(); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.yourlayout); dialog.show();
Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.mhp); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.show();
final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); dialog.setContentView(R.layout.popup_window); dialog.show();
public void customDialog() { Dialog dialog=new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); dialog.setContentView(R.layout.dialog_submit); dialog.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title); dialog.show(); }