Rami
Rami

Reputation: 7929

Is it possible to scale a TimePickerDialog (or a Dialog)?

I have a simple/default TimePickerDialog:

TimePickerDialog timePickerDialog = new TimePickerDialog(getActivity());
timePickerDialog.setTitle("Select Time");
timePickerDialog.show();

My problem:

No matter how the device dimension (4", 7", 10"...) , the dialog always take the full screen size when it's shown (screenshot below).

My question:

Is it possible to scale (not resize) the dialog view?

Like this:

PS:

1) I don't want to use a Dialog with a custom view.

2) This is what i get when i resize the dialog:

 Display display =((WindowManager)getActivity().getSystemService(getActivity().WINDOW_SERVICE)).getDefaultDisplay();
 int width = display.getWidth();
 int height=display.getHeight();

 timePickerDialog.getWindow().setLayout((width) / 2, (height) / 2);

Upvotes: 1

Views: 1262

Answers (1)

TheAndroidFreak
TheAndroidFreak

Reputation: 72

Create your own time picker dialog by extending it.

read the following thread.

Show TimePicker with minutes intervals in android

Upvotes: 1

Related Questions