-3
public class Test extends AppCompatActivity
 {
     @Override
     protected void onCreate(Bundle savedInstanceState)
     {

      super.onCreate(savedInstanceState);
      supportRequestWindowFeature(Window.FEATURE_NO_TITLE);

    }
}

when start activity ,it act as dialog .Here problem is the dialog window display at top , but I want it display in center.

ashok
  • 431
  • 5
  • 8
  • 1
    Please check this (https://stackoverflow.com/questions/10412192/android-display-custom-dialog-in-center-of-the-container) – Sanjay Bhalani Jan 31 '20 at 05:25

1 Answers1

-1

You can try this to show dialog anywhere with the help of gravity

Window window = dialog.getWindow();
window.setLayout(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
window.setGravity(Gravity.CENTER);
S.Ambika
  • 292
  • 1
  • 14