android - Kivy FileChooser 在某些 android 手机上不能作为 apk 工作,我该如何解决?
问题描述
当我尝试实现 kivy 的文件选择器时,我发现它在没有 Xaomi 手机的情况下在任何地方都运行良好。当我转到该页面时,它显示文件选择器的空布局。我的代码如下:
Mypopup:
pos: (root.width * .025, root.height *.020)
#size:(300,300)
auto_dismiss: True
size_hint:(1,1)
id:pop
BoxLayout:
orientation:'vertical'
FileChooserIconView:
id: filechooser
on_selection: pop.selected(filechooser.selection)
Button:
text:'upload'
size_hint_x:.7
size_hint_y:.1
background_color:1,1,1,1
on_release:pop.dismiss
pos_hint:{'center_x':.5,'center_y':.5}
on_press: app.next_screen('resource/tima/know_myself/my_information')
解决方案
尝试路径/storage/emulated/0/
例如,将其添加到您的.kv
文件中,如下所示:
#:import platform kivy.utils.platform
FileChooserListView:
rootpath: '/storage/emulated/0/' if platform == 'android' else '/'
推荐阅读
- build - 如何设置子类模型的输入形状?
- hive - Hive HBase 快照查询结果无法插入新表
- java - 如何获取从结果集中的值动态创建的特定 Jlabel 的名称。使用 JPop 菜单项?
- google-cloud-firestore - Firestore 查询日期范围
- build - hiddenapi 上 SIGILL 的 AOSP9.0 构建失败
- java - 当我收到错误“错误:'size_t'没有命名类型”时,如何让源媒体安装 Apache Accumulo?
- python - 将包含表情符号的 JSON 读入 Pandas 数据框
- amazon-web-services - 在关闭之前将 docker 日志从 ec2 实例上传到 S3
- three.js - 三.RGBELoader() HDR曝光不改变
- gtk3 - 如何让 gtk3 自定义按钮字体、背景和前景色?