我的选择器代码如下:
var mimetypes = "application/vnd.ms-excel," +
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet," +
"application/vnd.google-apps.spreadsheet," +
"application/vnd.ms-powerpoint," +
"application/vnd.openxmlformats-officedocument.presentationml.presentation," +
"application/vnd.google-apps.presentation," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.document," +
"application/msword," +
"application/vnd.google-apps.document," +
"application/pdf,"+
"application/vnd.google-apps.folder";
var view = new google.picker.View(google.picker.ViewId.DOCS);
view.setMimeTypes(mimetypes);
var docsView = new google.picker.DocsView()
.setIncludeFolders(true)
.setMimeTypes('application/vnd.google-apps.folder')
.setSelectFolderEnabled(true);
var folderView = new google.picker.View(google.picker.ViewId.FODLERS);
folderView.setMimeTypes("application/vnd.google-apps.folder");
var picker = new google.picker.PickerBuilder()
.enableFeature(google.picker.Feature.MINE_ONLY)
.enableFeature(google.picker.Feature.NAV_HIDDEN)
.setAppId(appId)
.setOAuthToken(oauthToken)
.addView(view)
.addView(docsView)
.addView(folderView)
.addView(new google.picker.DocsUploadView())
.setSelectableMimeTypes(mimetypes)
.setDeveloperKey(developerKey)
.setCallback(pickerCallback)
.build();
picker.setVisible(true);
我添加了视图以启用“ setSelectFolderEnabled ”,但在选择文件夹形式选择器视图后,底部的“选择”按钮仍然处于禁用状态。我需要回调中的文件夹Id进行进一步处理。但即使选择了文件夹,我也无法弄清楚如何启用该按钮。
Google Picker API是否仅允许选择保存在Google云端硬盘中的文件?
答案 0 :(得分:3)
只需将我的代码更改为此代码就可以了:
<android.support.v4.widget.NestedScrollView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="hello world jheds sdjhs jds sjbs skjs ksjs kksjs ksj sdd dskd js sk "
android:textSize="25dp"
android:textStyle="bold" />
/// Add your other code here
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
答案 1 :(得分:0)
尝试在google.picker.ViewId.FOLDERS
中添加addView
viewId。我认为您无法选择文件夹,因为它未在PickerView.Builder
中设置。有关视图描述的更多信息,请参阅Picker API文档的Showing Different Views。
之后,确定您是否有写入范围以便将文件上传到云端硬盘。