<i id='nQ8D7'><tr id='nQ8D7'><dt id='nQ8D7'><q id='nQ8D7'><span id='nQ8D7'><b id='nQ8D7'><form id='nQ8D7'><ins id='nQ8D7'></ins><ul id='nQ8D7'></ul><sub id='nQ8D7'></sub></form><legend id='nQ8D7'></legend><bdo id='nQ8D7'><pre id='nQ8D7'><center id='nQ8D7'></center></pre></bdo></b><th id='nQ8D7'></th></span></q></dt></tr></i><div id='nQ8D7'><tfoot id='nQ8D7'></tfoot><dl id='nQ8D7'><fieldset id='nQ8D7'></fieldset></dl></div>

    <small id='nQ8D7'></small><noframes id='nQ8D7'>

    <legend id='nQ8D7'><style id='nQ8D7'><dir id='nQ8D7'><q id='nQ8D7'></q></dir></style></legend>
    <tfoot id='nQ8D7'></tfoot>
      <bdo id='nQ8D7'></bdo><ul id='nQ8D7'></ul>

      1. 如何在 Kivy ScrollView 中滚动 GridLayout?

        时间:2023-10-10
        <tfoot id='Lpwge'></tfoot>
            <tbody id='Lpwge'></tbody>
          <i id='Lpwge'><tr id='Lpwge'><dt id='Lpwge'><q id='Lpwge'><span id='Lpwge'><b id='Lpwge'><form id='Lpwge'><ins id='Lpwge'></ins><ul id='Lpwge'></ul><sub id='Lpwge'></sub></form><legend id='Lpwge'></legend><bdo id='Lpwge'><pre id='Lpwge'><center id='Lpwge'></center></pre></bdo></b><th id='Lpwge'></th></span></q></dt></tr></i><div id='Lpwge'><tfoot id='Lpwge'></tfoot><dl id='Lpwge'><fieldset id='Lpwge'></fieldset></dl></div>

          <small id='Lpwge'></small><noframes id='Lpwge'>

            <legend id='Lpwge'><style id='Lpwge'><dir id='Lpwge'><q id='Lpwge'></q></dir></style></legend>

              • <bdo id='Lpwge'></bdo><ul id='Lpwge'></ul>

                • 本文介绍了如何在 Kivy ScrollView 中滚动 GridLayout?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  目前这是我无法滚动的 kv 代码:

                  At the moment this is my kv code that is not scrollable:

                  BoxLayout:
                      id: bl
                      orientation: 'vertical'
                      padding: 10, 10
                      row_default_height: '48dp'
                      row_force_default: True
                      spacing: 10, 10
                  
                      GridLayout:
                          id: layout_content
                          cols: 1
                          row_default_height: '20dp'
                          row_force_default: True
                          spacing: 0, 0
                          padding: 0, 0
                  
                          Label:
                              text: 'You don''t have any downloads. Please add new download from Home screen'
                  

                  如何让上面的 kv 代码可滚动?我知道 Kivy ScrollView 只接受一个孩子,而且我已经让 GridLayout 成为新 ScrollView 的孩子.但它不起作用.有什么建议吗?

                  How do you make the above kv code scrollable? I know that Kivy ScrollView only accept one child, and I have already make GridLayout to be child of a new ScrollView. But it's not working. Any suggestion?

                  推荐答案

                  根据ScrollView 的文档 您必须至少禁用 ScrollView 的子 size_hint 之一:

                  According to the documentation for ScrollView you have to disable at least one of the ScrollView's child size_hint:

                  <Controller>:
                      layout_content: layout_content
                      BoxLayout:
                          id: bl
                          orientation: 'vertical'
                          padding: 10, 10
                          row_default_height: '48dp'
                          row_force_default: True
                          spacing: 10, 10
                          ScrollView:
                              size: self.size
                              GridLayout:
                                  id: layout_content
                                  size_hint_y: None
                                  cols: 1
                                  row_default_height: '20dp'
                                  row_force_default: True
                                  spacing: 0, 0
                                  padding: 0, 0
                  
                                  Label:
                                      text: "Lorem ipsum dolor sit amet"
                  

                  并绑定布局的大小以适应自身:

                  And bind the layout's size to adapt itself:

                  # main.py
                  
                  class Controller(FloatLayout):
                      layout_content=ObjectProperty(None)
                  
                      def __init__(self, **kwargs):
                          super(Controller, self).__init__(**kwargs)
                          self.layout_content.bind(minimum_height=self.layout_content.setter('height'))
                  

                  这篇关于如何在 Kivy ScrollView 中滚动 GridLayout?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:阿拉伯语文本的 Kivy 文本输入 下一篇:Python - Kivy:AttributeError:'super'对象在尝试获取

                  相关文章

                  最新文章

                • <small id='KGf3x'></small><noframes id='KGf3x'>

                  <i id='KGf3x'><tr id='KGf3x'><dt id='KGf3x'><q id='KGf3x'><span id='KGf3x'><b id='KGf3x'><form id='KGf3x'><ins id='KGf3x'></ins><ul id='KGf3x'></ul><sub id='KGf3x'></sub></form><legend id='KGf3x'></legend><bdo id='KGf3x'><pre id='KGf3x'><center id='KGf3x'></center></pre></bdo></b><th id='KGf3x'></th></span></q></dt></tr></i><div id='KGf3x'><tfoot id='KGf3x'></tfoot><dl id='KGf3x'><fieldset id='KGf3x'></fieldset></dl></div>
                    <bdo id='KGf3x'></bdo><ul id='KGf3x'></ul>
                    <legend id='KGf3x'><style id='KGf3x'><dir id='KGf3x'><q id='KGf3x'></q></dir></style></legend>
                    <tfoot id='KGf3x'></tfoot>