Matisse
Matisse copied to clipboard
在打开相册后,左上角切换其他相册,全部都是一片空白,只有刚进来的时候 全部相册才有内容!!!这个问题也太大了吧
http://s.pz.com/u/8003/94/1/160049310359.jpg http://s.pz.com/u/8003/94/1/16004931036.jpg 请看截图
将Matisse的代码下载到本地,然后修改AlbumMediaLoader类中的ORDER_BY属性,改为:
private static final String ORDER_BY = MediaStore.Images.Media.DATE_MODIFIED+ " DESC";
也是无效的,特别急!
@Fudejun520 LZ解决了吗
@Fudejun520 replacing implementation 'androidx.fragment:fragment:1.3.0-alpha08' with implementation 'androidx.fragment:fragment:1..3.0-alpha06' 改一下androidx fragment的版本试试
@Fudejun520 replacing implementation 'androidx.fragment:fragment:1.3.0-alpha08' with implementation 'androidx.fragment:fragment:1..3.0-alpha06' 改一下androidx fragment的版本试试
可以了
@Fudejun520 replacing implementation 'androidx.fragment:fragment:1.3.0-alpha08' with implementation 'androidx.fragment:fragment:1..3.0-alpha06' 改一下androidx fragment的版本试试
这个在哪边改的?找了一遍没看到。
@Fudejun520 replacing implementation 'androidx.fragment:fragment:1.3.0-alpha08' with implementation 'androidx.fragment:fragment:1..3.0-alpha06' 改一下androidx fragment的版本试试
可以了
这个在哪边改的?找了一遍没看到。
@Fudejun520 replacing implementation 'androidx.fragment:fragment:1.3.0-alpha08' with implementation 'androidx.fragment:fragment:1..3.0-alpha06' 改一下androidx fragment的版本试试
可以了
这个在哪边改的?找了一遍没看到。
'androidx.appcompat:appcompat:1.3.0-alpha01'
遇到同样的问题,个人解决方案: 在 MatisseActivity.onAlbumSelected 中将 replace fragment,改为 remove 和 add
private Fragment fragment;
private void onAlbumSelected(Album album) {
if (album.isAll() && album.isEmpty()) {
mContainer.setVisibility(View.GONE);
mEmptyView.setVisibility(View.VISIBLE);
} else {
mContainer.setVisibility(View.VISIBLE);
mEmptyView.setVisibility(View.GONE);
if (fragment != null) {
getSupportFragmentManager()
.beginTransaction()
.remove(fragment)
.commitAllowingStateLoss();
}
fragment = MediaSelectionFragment.newInstance(album);
getSupportFragmentManager()
.beginTransaction()
.add(R.id.container, fragment, MediaSelectionFragment.class.getSimpleName())
.commitAllowingStateLoss();
}
}
我的 fork 版本 解决了这个问题,同时还修复一些其他问题,适配了新的 Result Api https://github.com/lwj1994/Matisse
androidx.fragment:fragment:1..3.0-alpha06 就是 这个问题,改成这个就行了
在MediaSelectionFragment的onActivityCreated方法里按下面的修改试试
mRecyclerView.post(() -> { mAlbumMediaCollection.onCreate(getActivity(), this); mAlbumMediaCollection.load(album, selectionSpec.capture); });
我的是将 implementation 'androidx.appcompat:appcompat:1.3.0',退回 1.2.0 版本, 即:implementation 'androidx.appcompat:appcompat:1.2.0' 然后解决了问题。应该是androidx中的fragment库某个版本有问题。
Encountered the same problem, personal solution: Change the replace fragment in MatisseActivity.onAlbumSelected to remove and add
private Fragment fragment; private void onAlbumSelected(Album album) { if (album.isAll() && album.isEmpty()) { mContainer.setVisibility(View.GONE); mEmptyView.setVisibility(View.VISIBLE); } else { mContainer.setVisibility(View.VISIBLE); mEmptyView.setVisibility(View.GONE); if (fragment != null) { getSupportFragmentManager() .beginTransaction() .remove(fragment) .commitAllowingStateLoss(); } fragment = MediaSelectionFragment.newInstance(album); getSupportFragmentManager() .beginTransaction() .add(R.id.container, fragment, MediaSelectionFragment.class.getSimpleName()) .commitAllowingStateLoss(); } }
@wangchenyan Thanks
看我的 PR: https://github.com/zhihu/Matisse/pull/863 更换 fragment 版本解决不了根本问题,后续如何兼容?问题是 livedata 监听的时候 onwer 的传递的问题,使用 fragment 而不是 activity 进行监听即可。
private Fragment fragment;
very nice
就是 appcompat 依赖的问题 ,项目中有很多其他不同版本的依赖,最终打包的时候使用了高版本的导致此问题出现,将replace替换成 remove 和 add 非常完美的解决了这个问题
androidx.appcompat:appcompat:1.2.0