-
Notifications
You must be signed in to change notification settings - Fork 3k
PictureSelector 3.0 如何重载布局?
Luck edited this page Jan 10, 2022
·
2 revisions
*注意:重载布局id和View不可删除和更改
.setInjectLayoutResourceListener(new OnInjectLayoutResourceListener() {
@Override
public int getLayoutResourceId(Context context, int resourceSource) {
switch (resourceSource) {
case InjectResourceSource.MAIN_SELECTOR_LAYOUT_RESOURCE:
return R.layout.ps_custom_fragment_selector;
case InjectResourceSource.PREVIEW_LAYOUT_RESOURCE:
return R.layout.ps_custom_fragment_preview;
case InjectResourceSource.MAIN_ITEM_IMAGE_LAYOUT_RESOURCE:
return R.layout.ps_custom_item_grid_image;
case InjectResourceSource.MAIN_ITEM_VIDEO_LAYOUT_RESOURCE:
return R.layout.ps_custom_item_grid_video;
case InjectResourceSource.MAIN_ITEM_AUDIO_LAYOUT_RESOURCE:
return R.layout.ps_custom_item_grid_audio;
case InjectResourceSource.ALBUM_ITEM_LAYOUT_RESOURCE:
return R.layout.ps_custom_album_folder_item;
case InjectResourceSource.PREVIEW_ITEM_IMAGE_LAYOUT_RESOURCE:
return R.layout.ps_custom_preview_image;
case InjectResourceSource.PREVIEW_ITEM_VIDEO_LAYOUT_RESOURCE:
return R.layout.ps_custom_preview_video;
case InjectResourceSource.PREVIEW_GALLERY_ITEM_LAYOUT_RESOURCE:
return R.layout.ps_custom_preview_gallery_item;
default:
return 0;
}
}
});