npm i --save nativescript-file-picker
- 版本:0.0.2
- GitHub:
- NPM: https://npmjs.net.cn/package/nativescript-file-picker
- 下载量
- 昨天: 0
- 上周: 0
- 上个月: 0
/* 尚未发布 */
Android: https://github.com/spacecowboy/NoNonsense-FilePicker/
从库页面复制
<img src="https://raw.githubusercontent.com/spacecowboy/NoNonsense-FilePicker/master/screenshots/Nexus10-picker-dark.png" width="50%"
<img src="https://raw.githubusercontent.com/spacecowboy/NoNonsense-FilePicker/master/screenshots/Nexus10-picker-light.png" width="50%"
在您的清单文件中包含权限
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
包含文件选择活动
Intent 过滤器根据您的用例是可选的。请注意,清单中设置的主题很重要。
<activity
android:name="com.nononsenseapps.filepicker.FilePickerActivity"
android:label="@string/app_name"
android:theme="@style/FilePickerTheme">
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
配置主题
您必须在活动上设置 主题,但您可以将其配置为与现有应用程序主题匹配。您也可以将其命名为您喜欢的任何名称。
</style>
<style name="FilePickerTheme" parent="NNF_BaseTheme.Light">
<!-- Set these to match your theme -->
<item name="colorPrimary">@color/ns_primary</item>
<item name="colorPrimaryDark">@color/ns_primaryDark</item>
<item name="colorAccent">@color/ns_accent</item>
<!-- Setting a divider is entirely optional -->
<item name="nnf_list_item_divider">?android:attr/listDivider</item>
<!-- Need to set this also to style create folder dialog -->
<item name="alertDialogTheme">@style/FilePickerAlertDialogTheme</item>
<!-- If you want to set a specific toolbar theme, do it here -->
<!-- <item name="nnf_toolbarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> -->
</style>
<style name="FilePickerAlertDialogTheme" parent="Theme.AppCompat.Dialog.Alert">
<item name="colorPrimary">@color/ns_primary</item>
<item name="colorPrimaryDark">@color/ns_primaryDark</item>
</style>
文档:所以..oo..on