Rendering Issue related to ScrollView

32 views
Skip to first unread message

Yassine Ouchen

unread,
Jan 21, 2025, 2:45:53 PM1/21/25
to Kivy users support

I've encountered an issue where the borders of widgets to be scrolled start appearing outside the ScrollView boundaries. This issue happens only when using KivyMD widgets (MDFloatLayout, MDBoxLayout, MDLinearProgressIndicator, etc.) with a background color.

example2.PNG

The issue seems to be related to how KivyMD handles background color rendering compared to Kivy's native canvas instructions. Using regular Kivy widgets with canvas instructions properly constrains the background within the ScrollView.

For example, when I changed this:

MDFloatLayout:
    size_hint: None, None
    size: '42dp', '42dp'
    md_bg_color: some_color
    radius: 10

To this: 

FloatLayout:
    size_hint: None, None
    size: '42dp', '42dp'
    canvas.before:
        Color:
            rgba: some_color
        RoundedRectangle:
            size: self.size
            pos: self.pos
            radius: [10,] * 4

The issue disappeared.

Has anyone else encountered this?

I'm using: kivy 2.3.0, kivymd 2.0.1.dev0

ElliotG

unread,
Jan 21, 2025, 10:37:59 PM1/21/25
to Kivy users support
I've not had this issue - but my use of KivyMD is limited.  I suggest taking a look at the KivyMD source and see if you can find the reason for the behavior.
Reply all
Reply to author
Forward
0 new messages