Divider#
#
Added in version 2.0.0.
See also
Dividers are thin lines that group content in lists or other containers.
Make dividers visible but not bold
Only use dividers if items can’t be grouped with open space
Use dividers to group things, not separate individual items
KivyMD provides the following bar positions for use:
HorizontalDivider#
Dividers are one way to visually group components and create hierarchy. They can also be used to imply nested parent/child relationships.
from kivy.lang import Builder
from kivymd.app import MDApp
KV = '''
MDScreen:
md_bg_color: self.theme_cls.backgroundColor
MDDivider:
size_hint_x: .5
theme_divider_color: "Custom"
color: self.theme_cls.onBackgroundColor
pos_hint: {'center_x': .5, 'center_y': .5}
'''
class Example(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
return Builder.load_string(KV)
Example().run()
from kivymd.app import MDApp
from kivymd.uix.divider import MDDivider
from kivymd.uix.screen import MDScreen
class Example(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
return (
MDScreen(
MDDivider(
size_hint_x=0.5,
pos_hint={'center_x': 0.5, 'center_y': 0.5},
theme_divider_color="Custom",
color=self.theme_cls.onBackgroundColor,
),
md_bg_color=self.theme_cls.backgroundColor
)
)
Example().run()
VerticalDivider#
A vertical divider can be used to arrange content on a larger screen, such as separating paragraph text from video or imagery media.
MDDivider:
size_hint_y: .5
orientation: "vertical"
MDDivider(
orientation="vertical",
size_hint_y=0.5,
)
API break#
1.2.0 version#
MDSeparator:
[...]
2.0.0 version#
MDDivider:
[...]
API - kivymd.uix.divider.divider#
- class kivymd.uix.divider.divider.MDDivider(**kwargs)#
A divider line.
Added in version 2.0.0.
For more information, see in the
ThemableBehaviorandBoxLayoutclasses documentation.- color#
Divider color in (r, g, b, a) or string format.
coloris aColorPropertyand defaults to None.
- divider_width#
Divider width.
divider_widthis anNumericPropertyand defaults to dp(1).