Closed BarisF closed 8 years ago
I don't understand what do you mean by padding here. Title, summary, icon and other components of AbsMaterialPreferences subclasses have predefined paddings. As for the default value - yeah, good point. Will add this when I have time.
Here what i want to say, without padding and with padding and divider using linearlayout.
Send your xml please.
I use LinearLayout with android:paddingStart and android:paddingEnd because it's not possible with MaterialStandardPreference, ...
` < com.yarolegovich.mp.MaterialPreferenceCategory android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/pref_cat_general" app:mpc_title="@string/pref_general" android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:divider="@drawable/divider"
android:showDividers="middle"
android:orientation="vertical">
<com.yarolegovich.mp.MaterialChoicePreference
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/pref_language"
app:mp_key="pref_key_language"
app:mp_default_value="English"
app:mp_title="@string/pref_title_languages"
app:mp_show_value="onRight"
app:mp_entry_values="@array/languages" />
<com.yarolegovich.mp.MaterialStandardPreference
android:layout_width="match_parent"
android:layout_height="50dp"
app:mp_title="Copyright"
app:mp_summary="Inovim @ 2016" />
<com.yarolegovich.mp.MaterialStandardPreference
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/pref_version"
app:mp_key="pref_key_version"
app:mp_title="Version" />
</LinearLayout>
</com.yarolegovich.mp.MaterialPreferenceCategory>`
What version are you testing on? LinearLayout is not needed there, paddings should already be applied (no need to specify them in preference category too). And better not hardcode height, this can cut some part of info. https://pp.vk.me/c630322/v630322751/31fad/HA_CLCLrQ90.jpg https://pp.vk.me/c630322/v630322751/31fa3/ncLIWfzp1W0.jpg
Api 18 it's not working, then I add LinearLayout, tested on API 23 it's working but I need for API 18.
I figured it out. Think this is due to support library update. For some reason
setBackgroundResource(Utils.clickableBackground(getContext()));
Removed paddings on pre-lollipop. Will push an update in 10 minutes. Thank you for pointing. https://github.com/yarolegovich/MaterialPreferences/blob/master/library/src/main/java/com/yarolegovich/mp/AbsMaterialPreference.java#L213
Ok thanks, It'll be good too to put divider for MaterialPreferenceCategory.
use version 1.0.5 now. should work. as for dividers - I don't have time now, maybe later. or you can do it yourself and create a pull request ;)
Ok if I've time too.
It's not possible to add padding left and right ? For the moment, I used LinearLayout in MaterialPreferenceCategory.
And It'll be great for single choice to show the selected pref when it launch and for the others to show in the editbox the value if it exists already too.