这个问题其实跟Kivy中其余控件反对中文一样,都是字体的问题,而不是字符集的问题,但我看网上能搜到的答案,全都围着字符集打转,有些还煞有介事地答复说:给 FileChooserListView
减少 file_encodings: ["utf-8"]
属性就能解决
其实基本没用——人家官网文档曾经写了,缺省的字符集就是:[‘utf-8’, ‘latin1’, ‘cp1252’]
,曾经蕴含utf-8反对。
实际上只有减少font_name设置就能够了,比方官网示例,能够改成如下的模式:
<code class="yaml"><LoadDialog>: BoxLayout: size: root.size pos: root.pos orientation: "vertical" FileChooserListView: id: filechooser # 这里设置字体为安卓规范中文 font_name:'DroidSansFallback' # ------------------------- BoxLayout: size_hint_y: None height: 30 Button: text: "Cancel" on_release: root.cancel() Button: text: "Load" on_release: root.load(filechooser.path, filechooser.selection)
别忘了把字体文件放在我的项目哦。