Reputation: 11
I have a preference
in which I am setting my title and summary programmatically
PreferenceScreen screen= parent.getPreferenceManager().createPreferenceScreen(context);
screen.setTitle(R.string.color_title);
screen.setSummary(R.string.color_summary);
Now I want to apply an icon to my preference.
screen.setIcon(shape);
But this icon is aligned to left of my title and summary Is there any way to right align this icon in my preference?
Upvotes: 1
Views: 893
Reputation: 3316
Use the following attribute in preference:
android:widgetLayout="@layout/preference_right_chevron_layout"
Additionally, create a layout in layout directory with the image.
This will position the icon on the right side of preference item.
Upvotes: 2
Reputation: 530
sharedPreference is keyValue store function its store only primitive datatype. If you want to store image or icon it's cant saved. You can save image path in shared preference. If you dont know path then you Should change image into bitmap and bitmap to string then save and want to show then convert string to bitmap and bitmap show in imageview. please prefer below link How can I store images using sharedpreference in android?
Upvotes: 0