Guest User

Untitled

a guest
Jan 21st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. Dialog newServerDialog = new Dialog(getContext(), R.style.CustomDialogStyleServerDetails);
  2.  
  3. newServerDialog.setContentView(newServerDialogLayout);
  4. newServerDialog.setTitle(R.string.server_details_new_title_text);
  5. newServerDialog.getWindow().setLayout(
  6. android.view.ViewGroup.LayoutParams.FILL_PARENT,
  7. android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
  8. newServerDialog.setCancelable(true);
  9.  
  10. <style name="CustomDialogStyleServerDetails" parent="@android:style/Theme.Dialog">
  11. <item name="android:background">@drawable/server_details_background_repeat</item>
  12. <item name="android:windowTitleStyle">@style/DialogWindowTitle</item>
  13. </style>
  14.  
  15. <style name="DialogWindowTitle">
  16. <item name="android:maxLines">1</item>
  17. <item name="android:scrollHorizontally">true</item>
  18. <item name="android:textAppearance">@style/customDialogTextAppearance</item>
  19. <item name="android:gravity">center_horizontal|center_vertical</item>
  20. <item name="android:background">@drawable/server_details_title_background_repeat</item>
  21. </style>
  22.  
  23. ContextThemeWrapper mTheme = new ContextThemeWrapper(this,
  24. R.style.CustomDialogStyleServerDetails);
  25.  
  26. mInflater = (LayoutInflater) getBaseContext().getSystemService(
  27. LAYOUT_INFLATER_SERVICE);
  28.  
  29. ContextThemeWrapper mTheme = new ContextThemeWrapper(this,
  30. R.style.CustomDialogStyleServerDetails);
  31.  
  32. mView = mInflater.inflate(R.layout.YOUR_XML_LAYOUT_FILE, null);
  33.  
  34.  
  35. mDialog = new Dialog(mTheme);
  36. mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
  37. mDialog.setContentView(this.mView);
  38. mDialog.show();
Add Comment
Please, Sign In to add comment