【问题标题】:Is that possible to remove the ripple effect in MDIconButton in KivyMD是否可以消除 KivyMD 中 MDIconButton 中的涟漪效应
【发布时间】:2021-05-26 17:13:44
【问题描述】:

是否可以消除 KivyMD 中 MDIconButton 中的涟漪效应?

我正在尝试使用 python KivyMD 开发应用程序,为了获得更好的用户体验,我想消除 MDIconButton 的涟漪效果

ma​​in.py

from kivymd.app import MDApp
from kivy.uix.relativelayout import RelativeLayout



class MainWidget(RelativeLayout):
    pass

class TestApp(MDApp):
    def build(self):

        self.theme_cls.theme_style = "Dark"
        


if __name__ == '__main__':
    TestApp().run()


test.kv

MainWidget:
    RelToolBar:

<RelToolBar@RelativeLayout>:
    size_hint: 1,.05
    pos_hint: {'x':0 , 'top':1 }
    canvas.before:
        Color:
            rgba: 0, 0, 0, .4
        Rectangle:
            size: self.size
    MDIconButton:
        halign: "center"
        icon: "menu"
        theme_text_color: "Primary"
        pos_hint: {'x':0 , 'center_y':.5 }
    MDLabel:
        text: "T E S T"
        theme_text_color: "Primary"
        halign: 'center'
        font_style: "Caption"

【问题讨论】:

    标签: python kivy kivymd


    【解决方案1】:

    我不认为你可以删除它,但你可以通过将RippleBehavior 的大小更改为 0 来隐藏它:

    MDIconButton:
        ripple_scale: 0
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-18
      • 1970-01-01
      • 2016-03-24
      • 2016-04-25
      • 2017-01-07
      • 2019-06-05
      • 2018-02-23
      • 2020-05-30
      相关资源
      最近更新 更多