当 readonly 为 True 时,有没有办法滚动文本

Is there a way to scroll text when readonly is True

我有这个 .kv 代码,当只读为 false 时它会滚动,但是当只读为 true 时它不会滚动。 请问我怎样才能让它在只读设置为真时滚动。 谢谢

enter code here <January1Window>:
name: "January1"
scroll:scroll
direction:'tb-lr'
size:(1480, 854)
ScrollView:
    id:scroll
    bar_color:(0, 0, 0, 0.4)
    bar_inactiv_color:(0, 0, 0.7, 0.4)
    bar_margin:2
    bar_width:8
    on_scroll_x:January1.focus = True
    on_scroll_y:January1.focus = True
    TextInput:
        size_hint:(0.8, 0.5)
        id:January1
        text: root.showJanuary1()
        padding:50
        readonly: True
        do_scroll_x:True
        do_scroll_y:True
        pos_hint: {'center_x': 0.4, 'center_y':0.35}
        #background_color: 3,0,0.2, 0.7

我没有看到 readonly 的值有任何影响。但是,对于要滚动的方向,您需要将 size_hint 设置为 None。例如:

    TextInput:
        size_hint:(0.8, None)
        height: self.minimum_height
BoxLayout:
orientation: 'vertical'
Label:
    text: 'Scroll TextInput'
    size_hint_y: None
    height: 48
ToggleButton:
    size_hint_y: None
    height: 48
    text: 'Set Read-Only'
    on_state: text_input.readonly = True if self.state else False
ScrollView:

    bar_color:(0, 0, 0, 0.4)
    bar_inactiv_color:(0, 0, 0.7, 0.4)
    bar_margin:2
    bar_width:8
    do_scroll_x:True
    do_scroll_y:True
    TextInput:
        id: text_input
        size_hint: .8, None
        height: self.minimum_height
        text: 'This is a long long long set of words\n' * 100

感谢 Elliot Garbus