Comments (12)
@389273716 你先通过_mActivity.logFragmentStackHierarchy(TAG) 来打印log确认栈内状态,应该不会出现这个情况,你参照下我的demo写法,demo是没任何问题的;点击调用pop或者_mActivity.onBackpress()都是可以的
我下午checkout你的项目看下哈
from fragmentation.
showFragmentStackHierarchyView();我用这个进行查看是没有清空对应fragment的。晚上我再仔细看看demo改改。
from fragmentation.
@389273716 我看了你的项目,如果Fragment继承你的BaseViewFragment,就会出现pop问题,猜测可能你BaseViewFragment的装填View的时候导致的问题;(如果改成直接继承SupportFragment,就可以正常工作~)
我的Fragmentation在add Fragment的时候比我们正常使用的时候多了个.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
用以在Fragment的onCreateAnimtation方法里自定义动画。
而恰巧是.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
这行代码导致在你的BaseViewFragment里导致pop()不能正常工作,因为如果我手动getFragmentManager.xx.add的话是可以正常pop()的
因为你的代码封装的还是比较深的,包括用装填的方式封装View,所以我现在还不确定为何导致这个问题
(PS:你的项目虽然就2个页面,但是apk体积超过了40M.... - -!)
from fragmentation.
恩,非常感谢^_^。包很大是因为我在了解crosswalk这个库,看看加载web面的有什么不同。(但是这个包会很大。。。)我这里基类的loadlayout装填后续fragment的具体布局,可能是这个原因吧,我是想所有fragment公用一套加载、成功、失败、空数据的view框架,因为android似乎没有模板页、框架页这种,要统一界面布局以及统一处理好麻烦。。。你的demo里都是每个fragment界面都把appbar之类的都复制一份进去,我觉得麻烦,所以想尝试下能不能不这样做。
from fragmentation.
我也是使用baseViewFragment封装一遍,当栈中只有两个fragment的时候,第二个Fragment就无法出栈,但是在第二个之后打开的第三个,四个都可以pop,我的想法和楼主一样,也是希望可以用一套标准的view把我fragment中的view包裹起来
from fragmentation.
@389273716 嗯嗯 我正式环境中, 加载、成功、失败空数据等一些布局是封装成一个个自定义View,组件形式加进来,比较解耦的做法 :)
from fragmentation.
嗯 你那个看起来很酷 下午看了一会没发现为啥会有冲突 等以后有空我再看看哈~ :)
from fragmentation.
有没有类似的案例,我现在也是随手练习,反正不是公司项目,引用库,代码都是想尝试什么写什么,你这个方式我也试试,寻找一种比较好的类似母版页的web那种模式。有没有一种可能写一个插件,然后我们写内容布局,声明母版xml,然后在打包编译时自动加入到母版页里,形成新的xml,然后一起编译,实际代码是你demo那种,但是开发过程简便?这样我们只要在一个基类里写findview,init,也是可以统一界面风格并且方便修改逻辑代码了。
from fragmentation.
嗯 你的那个我看了,想法很好,不过要注意万能的基类虽然使用起来很方便,但是缺点主要会有代码冗余、团队其他成员、尤其新成员上手比较麻烦的问题
可以再分下层,功能再解耦下
from fragmentation.
恩,是的。而且我自己也发现一个baseview积累里代码太多了,不方便新人了解。你说的包的问题,我一直都没注意,虽然官方说了会变大(我以为几个M而已),我移除web库后小了N倍。。。而且我这里封装后用的库,还会明显感觉到装填view的时候会闪屏,可能是渲染等性能出现问题了。
from fragmentation.
watch下你的app 期待好的组件方式
哈哈 下午我编译的时候好久 我一看40M~
这个issue我先关了 这个问题的场景比较特殊
from fragmentation.
@MarnonLee 这个问题前几天已经找到原因,389273716他的项目中Fragment的onDestoryView里手动remove了View,这导致和.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)这行代码有某种冲突,onDestoryView里并不需要手动remove View,注释掉后就可以正常出栈了。
你看下你是否也是这种情况 :)
from fragmentation.
Related Issues (20)
- viewpager嵌套viewpager,中第二个viewpager中的onLazyInitView和onSupportVisible步骤 HOT 1
- 不维护可能是随着谷歌逐步对fragment的优化,作者觉得越来越鸡肋了吧 HOT 2
- 结合ViewPager的父布局底部会被键盘顶起 HOT 3
- 废弃的原因是什么 HOT 4
- fragment栈的问题 must call loadRootFragment first HOT 1
- EasyFragmentation
- google 官方fragment 导航框架 navigation-fragment+navigation-ui HOT 7
- 消息队列管理为什么size==1才执行 ,如果>1 那么岂不是无法执行了? HOT 2
- viewpager上有输入框,输入框会把底部导航栏顶起来怎么怎么解决 HOT 1
- Fragmentation升级版, 欢迎试用
- 这么好的开源库放弃更新太可惜了,有大佬能和作者接触下接手吗? HOT 5
- 字体大小异常问题
- Fragmentation升级版,欢迎试用 HOT 1
- 如果viewpager在activity第一层级,初始化的时候viewpager中所有fragment的onLazyInitView都会被回调 HOT 2
- 为什么在Handler.post里调用onSupportVisible, 而不是直接调用? HOT 1
- popTo() has not been attached yet HOT 2
- onSupportVisible 在三星note5、s6上 不可用
- JCenter to be dismissed - please migrate to Maven Central HOT 1
- 使用popTo方法时被pop的Fragment不会调用onDestroy方法
- pop 动画在高版本(SDK 31,androidx.fragment 1.3.6)上异常
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fragmentation.