martin-stone / hsv-alpha-color-picker-android

A color picker and a color preference for use in Android applications.
Apache License 2.0
290 stars 60 forks source link

No Buttons in DialogFragment #10

Closed davewiard closed 9 years ago

davewiard commented 9 years ago

I am trying to use HSV-Alpha within a support-v4 DialogFragment. I am able to instantiate the dialog and inflate the view correctly but I have no positive/negative buttons and no "no color" button. It makes no difference whether I am in portrait or landscape mode. I don't believe the buttons are falling off the bottom of the visible area, either. If I take away hex and alpha the dialog height shrinks accordingly but I still see no buttons. I also installed on a physical device with more screen real estate than the emulator and they don't show there either despite having a sizable percentage of screen available outside the dialog fragment. Both the emulator and phone are running Lollipop (5.0.1 and 5.1). My code is nearly verbatim copy/paste from the "Usage" section.

martin-stone commented 9 years ago

The view doesn't bring any buttons with it. You'll need to set them up with your dialog builder as with any other dialog.

Have you looked at the ColorPreference code? It shows how to set up the buttons with the dialog builder. (The DialogPreference base class sets up the negative button in this case.)

Maybe I'm misunderstanding the problem, in which case, show me your code for building the dialog.

davewiard commented 9 years ago

I was using another method to create the dialog than using AlertDialog. After switching and roughly following the ColorPreference code I have got a workable solution. I'm not using this dialog in a Preference screen so I had to discard a lot of the Preference-related stuff in the example. All is well and I have all three buttons working correctly now.