Git Product home page Git Product logo

Comments (12)

YoKeyword avatar YoKeyword commented on May 28, 2024

@389273716 你先通过_mActivity.logFragmentStackHierarchy(TAG) 来打印log确认栈内状态,应该不会出现这个情况,你参照下我的demo写法,demo是没任何问题的;点击调用pop或者_mActivity.onBackpress()都是可以的
我下午checkout你的项目看下哈

from fragmentation.

389273716 avatar 389273716 commented on May 28, 2024

showFragmentStackHierarchyView();我用这个进行查看是没有清空对应fragment的。晚上我再仔细看看demo改改。

from fragmentation.

YoKeyword avatar YoKeyword commented on May 28, 2024

@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.

389273716 avatar 389273716 commented on May 28, 2024

恩,非常感谢^_^。包很大是因为我在了解crosswalk这个库,看看加载web面的有什么不同。(但是这个包会很大。。。)我这里基类的loadlayout装填后续fragment的具体布局,可能是这个原因吧,我是想所有fragment公用一套加载、成功、失败、空数据的view框架,因为android似乎没有模板页、框架页这种,要统一界面布局以及统一处理好麻烦。。。你的demo里都是每个fragment界面都把appbar之类的都复制一份进去,我觉得麻烦,所以想尝试下能不能不这样做。

from fragmentation.

MarnoDev avatar MarnoDev commented on May 28, 2024

我也是使用baseViewFragment封装一遍,当栈中只有两个fragment的时候,第二个Fragment就无法出栈,但是在第二个之后打开的第三个,四个都可以pop,我的想法和楼主一样,也是希望可以用一套标准的view把我fragment中的view包裹起来

from fragmentation.

YoKeyword avatar YoKeyword commented on May 28, 2024

@389273716 嗯嗯 我正式环境中, 加载、成功、失败空数据等一些布局是封装成一个个自定义View,组件形式加进来,比较解耦的做法 :)

from fragmentation.

YoKeyword avatar YoKeyword commented on May 28, 2024

嗯 你那个看起来很酷 下午看了一会没发现为啥会有冲突 等以后有空我再看看哈~ :)

from fragmentation.

389273716 avatar 389273716 commented on May 28, 2024

有没有类似的案例,我现在也是随手练习,反正不是公司项目,引用库,代码都是想尝试什么写什么,你这个方式我也试试,寻找一种比较好的类似母版页的web那种模式。有没有一种可能写一个插件,然后我们写内容布局,声明母版xml,然后在打包编译时自动加入到母版页里,形成新的xml,然后一起编译,实际代码是你demo那种,但是开发过程简便?这样我们只要在一个基类里写findview,init,也是可以统一界面风格并且方便修改逻辑代码了。

from fragmentation.

YoKeyword avatar YoKeyword commented on May 28, 2024

嗯 你的那个我看了,想法很好,不过要注意万能的基类虽然使用起来很方便,但是缺点主要会有代码冗余、团队其他成员、尤其新成员上手比较麻烦的问题
可以再分下层,功能再解耦下

from fragmentation.

389273716 avatar 389273716 commented on May 28, 2024

恩,是的。而且我自己也发现一个baseview积累里代码太多了,不方便新人了解。你说的包的问题,我一直都没注意,虽然官方说了会变大(我以为几个M而已),我移除web库后小了N倍。。。而且我这里封装后用的库,还会明显感觉到装填view的时候会闪屏,可能是渲染等性能出现问题了。

from fragmentation.

YoKeyword avatar YoKeyword commented on May 28, 2024

watch下你的app 期待好的组件方式
哈哈 下午我编译的时候好久 我一看40M~
这个issue我先关了 这个问题的场景比较特殊

from fragmentation.

YoKeyword avatar YoKeyword commented on May 28, 2024

@MarnonLee 这个问题前几天已经找到原因,389273716他的项目中Fragment的onDestoryView里手动remove了View,这导致和.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)这行代码有某种冲突,onDestoryView里并不需要手动remove View,注释掉后就可以正常出栈了。
你看下你是否也是这种情况 :)

from fragmentation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.