Kivy:用kv设计

时间:2013-11-21 10:53:47

标签: python-2.7 kivy

我想删除两行之间未使用的空格。 这是我的.kv文件:

<MainLayout>:
    text_input: text_input
    logo100: logo100

    rows: 3

    orientation: 'horizontal'

    GridLayout:
        cols: 2
        orientation: 'vertical'
        row_force_default: True 
        row_default_height: 50
        padding: 20
        spacing: 10


        Image:
            id: logo100
            source: 'logo100.png'
            size_hint: .2, .1
            texture: self.texture
            size: self.texture_size

        TextInput:
            id: text_input
            markup: True
            font_size: 32
            size_hint: 1.8, .1
            multiline: False                    
            on_text_validate: root.on_enter()
            hint_text: 'Enter the url of the website and click enter'

我正在列表类中添加一个列表:

Builder.load_string("""
#:import lv kivy.uix.listview
#:import la kivy.adapters.listadapter
#:import fa kivy.factory.Factory

<ListItemButtonTitle@ListItemButton>:
    selected_color:   [24.0, 1.0, 0.39, 0.6]
    deselected_color: [1.0, 1.0, 1.0, 0.0]
    font_size: 32
    size: 100, 100
    line_height: 1
    #spacing: 100    

<ListViewModal>:
    list_view: list_view_id
    padding: 100
    spacing: 30

    ListView:
        id: list_view_id
        size_hint: .98,.98

        adapter:
            la.ListAdapter(data = "",
            cls=fa.ListItemButtonTitle)
""")

我想在不留空的情况下垂直追加列表。 可能是图片可以解释更多enter image description here

我在想那个

row_force_default: True 
row_default_height: 50

这样做会很好,但不,我不知道如何解决这个问题。

1 个答案:

答案 0 :(得分:1)

我找到了一个简单的解决方案: 在kv文件中将size_hint_y: None添加到GridLayout