Closed jemshit closed 9 years ago
Pretty sure I've made it like on the standard one of Android, but if you are not happy with it, you can change the layout. You can do it either by any of those options:
This is true for any kind of customization of the preferences layout.
1,2 not working
What exactly have you tried? Also, have you considered using margins instead?
1) cant edit generated .xml file of library 2) created my own copy and it didnt auto replace .xml
it must have the exact name, and in the layout folder of your project. I've just tested it now. It works fine. Here's what I did to the sample project: a. added the file 'mpl__preference.xml" into the layout folder, and put there a huge padding for the icon:
<com.lb.material_preferences_library.internal.widget.PreferenceImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxHeight="48dp"
android:maxWidth="48dp"
android:padding="20dp"
/>
b. edited the "settings_example.xml" and added to one of the preferences the icon:
<com.lb.material_preferences_library.custom_preferences.ListPreference
android:defaultValue="dark"
android:key="@string/pref_theme"
android:summary="%s"
android:title="Theme"
app:dialogTitle="dialog title"
app:entries="@array/pref_theme_list_entries"
app:entryValues="@array/pref_theme_list_values"
app:icon="@android:drawable/sym_def_app_icon"/>
And the result:
I am using gradle to use library, so how do i edit the original file? I don't think i can do that. Probably second option didn't also work for that reason, maybe i should download and copy library files into project.
and of course, #3 is always possible.
If you wish, send me an email, and I will email you with a working sample that shows #2 is possible.
Can we change the padding or margin of icon ?