Closed AkshayChordiya closed 9 years ago
@martin-stone Extremely sorry I fixed it easily.
Maybe you could share your solution. :smiley:
@Rainer-Lang Oh yeah sure, thanks for reminding.
Dialog
& add the following code:View view = GET_YOUR_DIALOG_VIEW
colorPickerView = (ColorPickerView) view.findViewById(R.id.colorPicker);
colorPickerView.setColor(YOUR_COLOR);
colorPickerView.showAlpha(true);
colorPickerView.showHex(true);
Dialog
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.rarepebble.colorpicker.ColorPickerView
android:id="@+id/colorPicker"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</FrameLayout>
Thanks. The color dialog is really big. How about scrolling (older devices)? Put in a scrollview? How about making a pr? ;-)
@Rainer-Lang
Actually I didn't need a ScrollView
so I didn't use it. You can add it as root element in the above example.
I'd love to PR but my code is based on upon 3rd Party Dialog
library
I use also a lib - material-dialogs.
@Rainer-Lang
Cool.
Here's the complete code for Dialog
side
MaterialDialog dialog = new MaterialDialog.Builder(getActivity())
.title(YOUR_TITLE)
.positiveText(android.R.string.ok)
.negativeText(android.R.string.cancel)
.callback(new MaterialDialog.ButtonCallback() {
@Override
public void onPositive(MaterialDialog dialog) {
super.onPositive(dialog);
// Save color here
// Reflect the color on UI
}
})
.customView(THE_LAYOUT_MENTIONED_ABOVE, false)
.build();
View view = dialog.getCustomView();
colorPickerView = (ColorPickerView) view.findViewById(R.id.colorPicker);
colorPickerView.setColor(YOUR_COLOR);
colorPickerView.showAlpha(true);
colorPickerView.showHex(true);
I hope this helps you
@AkshayChordiya WOW cool. :-) I also have a button for neutral="select no color". But I have a problem with scrolling this custom view in material-dialogs. Aidan said, that the material-dialogs are ok and the problem should be searched in the custom view. The height isn't calculated properly. I don't know - I haven't found anything... :-(
@martin-stone
I feel you copy the code which I pasted above, I mean the MaterialDialog
code & then tweak the Layout by wrapping the Views
inside with a ScollView
This should give you the functionality which you require.
@AkshayChordiya Do you think this would help? This would be really awesome! :-)
@Rainer-Lang It should help
Hi @martin-stone
I'm using try to use
ColorPickerView
directly inside aDialog
specificallyAlertDialog
but the view doesn't look like the one shown in the screenshot on main page.P.S: I like your library & I appreciate your work.