0

I have created an AlertDialog with custom view that displays a SeekBar. Styling the seekbar etc. is not a problem, but I'd like to know how I could make the theme of my AlertDialog mimic the Dialog that appears when changing phone's sound volume. I mean both the position on the screen (about 1/5th from the top) as well as the width (almost match parent).

For clarification a screenshot I found on the internet of the volume controls: http://triggertrap.com/wp-content/uploads/2013/09/media_volume.png

zilinx
  • 1,052
  • 8
  • 18

1 Answers1

0

I found out that I can move the dialog using method described in this post: https://stackoverflow.com/a/6050911

 AlertDialog dialog = builder.create();
 dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
 WindowManager.LayoutParams wmlp = dialog.getWindow().getAttributes();

 wmlp.gravity = Gravity.TOP | Gravity.LEFT;
 wmlp.x = 100;   //x position
 wmlp.y = 100;   //y position
 dialog.show();

It's still not the exact same length, but I guess without some global attribute or style to use, this would be difficult to mimic, as on tablets not only is the dialog specific length, it also has settings button to change volume of notifications and media.

I couldn't find such global style, I looked in Android source and even though I found VolumePreference class that seems to be close to what I'm trying to achieve, it didn't have any specific theme associated with it.

Community
  • 1
  • 1
zilinx
  • 1,052
  • 8
  • 18