Closed tcqq closed 7 years ago
Readme has a section about dividers. If that doesn't answer your question, please, come back here and let me know.
How to achieve this picture the dividing line? https://material.io/guidelines/patterns/settings.html#settings-usage
I tested it, but the effect is different
Please post a screenshot of what you currently have and highlight desired changes.
Don't copy paste, look at the PreferenceDividerDecoration API and source and pick what's best for your case. Understand what the code does:
listView.addItemDecoration(new PreferenceDividerDecoration(getContext()).drawBottom(false).drawBetweenItems(false));
setDivider(null);
Preference categories without title are currently not possible.
Extra spacing around dividers is something I can do.
Good news! You will be able to do both these things in the next version.
Cool, thank you
now seedbar the xml have problem,ImageView the maxHeight and maxWidth invalid because not add this code: “android:adjustViewBounds="true"”
You can now achieve what's shown on the material design settings screenshot.
SettingsFragment.java
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final RecyclerView listView = getListView();
final int padding = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics());
listView.setPadding(0, padding, 0, padding);
// We're using alternative divider.
listView.addItemDecoration(new PreferenceDividerDecoration(getContext())
.drawBetweenItems(false).paddingDp(listView.getContext(), 8));
setDivider(null);
// We don't want this. The children are still focusable.
listView.setFocusable(false);
}
You may also wrap preferences in preference categories without title
preferences.xml
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory>
<!-- Put a preference here. -->
</PreferenceCategory>
</PreferenceScreen>
This has been released in v1.3.0.
Ok thank you
material design specification the dividing line should be added below the grouping,how to add the division line below the group?
Like this: https://material.io/guidelines/patterns/settings.html#settings-usage