Previously about the Expendable List View set in Navigation Drawer:
If you don't like the divider line (separate line) too long, you wanna modify.
If you don't know how to fulfill what exactly you wanted, you can follow the steps as below:
1. Create xml file "list_divider.xml" - we can control the color and line style
Example:
list_divider.xml
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="60dp"
android:insetRight="5dp" >
<shape android:shape="rectangle" >
<solid android:color="#c0c0c0" />
<size android:height="0.5dp" />
</shape>
</inset>
android:insetLift & android:insetRight can control the line length.
2. Use "android:divider" in your expandablelistview like :
<ExpandableListView
.
.
.
.
android:divider:"@drawable/list_divider" // Call the "list_divider.xml" that you've created
</ExpandableListView>
You'll get the result as below:
Almost done!! We just modify the parent group list's divider line. We need to do one more thing!
3. Use "android:childDivider"
<ExpandableListView.
.
.
.
android:divider:"@drawable/list_divider"
android:childDivider:"@drawable/list_divider" // add childDivider for child group list
</ExpandableListView>
Completed!
Hope you like my [Android] [Kotlin] share note.
Thanks for your attention & Have a nice day!!



沒有留言:
張貼留言