Guest User

Untitled

a guest
Jul 16th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. android:theme="@android:style/Theme.Dialog"
  2.  
  3. @Override
  4. protected void onCreate(Bundle arg0) {
  5. super.onCreate(arg0);
  6. setContentView(R.layout.myxml);
  7.  
  8. LayoutParams params = getWindow().getAttributes();
  9. params.height = LayoutParams.FILL_PARENT;
  10. params.width = LayoutParams.FILL_PARENT;
  11. getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
  12. }
  13.  
  14. getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
  15.  
  16. @Override
  17. protected void onStart() {
  18. super.onStart();
  19. // In order to not be too narrow, set the window size based on the screen resolution:
  20. final int screen_width = getResources().getDisplayMetrics().widthPixels;
  21. final int new_window_width = screen_width * 90 / 100;
  22. LayoutParams layout = getWindow().getAttributes();
  23. layout.width = Math.max(layout.width, new_window_width);
  24. getWindow().setAttributes(layout);
  25. }
Add Comment
Please, Sign In to add comment