Closed IAmSarthakVerma closed 7 years ago
When I am selecting a drawable for palette from java code and returning the int color, the color is different from what it actually should be. Please help Here is the code for color picker view xml file -
<LinearLayout android:id="@+id/custom_picker_layout" android:layout_width="0dp" android:layout_height="232dp" android:layout_marginTop="16dp" android:layout_weight="3" android:visibility="gone"> <com.skydoves.colorpickerview.ColorPickerView android:id="@+id/custom_picker" android:layout_width="match_parent" android:layout_height="match_parent" app:selector="@drawable/dot" /> </LinearLayout>
Here is the java code for setting the drawable and listening color change-
Uri myuri = Uri.fromFile(new File(images.get(i).path)); LinearLayout customPickerLayout = (LinearLayout) findViewById(R.id.custom_picker_layout); LinearLayout colorPickerLayout = (LinearLayout) findViewById(R.id.color_picker_layout); customPicker = (ColorPickerView) findViewById(R.id.custom_picker); try { InputStream inputStream = getContentResolver().openInputStream(myuri); myDrawable = Drawable.createFromStream(inputStream, myuri.toString() ); } catch (FileNotFoundException e) { { Snackbar.make(findViewById(android.R.id.content), "Error loading image", Snackbar.LENGTH_LONG).setAction("Error", new View.OnClickListener() { @Override public void onClick(View view) { } }).show(); } } customPicker.setPaletteDrawable(myDrawable); colorPickerLayout.setVisibility(View.GONE); customPickerLayout.setVisibility(View.VISIBLE); customPicker.setPaletteDrawable(myDrawable); customPicker.setColorListener(new ColorPickerView.ColorListener() { @Override public void onColorSelected(int color) { setbtn.setBackgroundColor(customPicker.getColor()); } });
Hey guy, did you solved that issue?
When I am selecting a drawable for palette from java code and returning the int color, the color is different from what it actually should be. Please help Here is the code for color picker view xml file -
Here is the java code for setting the drawable and listening color change-