那些年遇到Fragment的坑

1.

Can I remove a fragment defined in a layout.xml file?

可以在程式裡,移除寫在layout裡的fragment嗎?
答案是不行,就算要hide起來也是不行。
程式會自動幫你keep住layout裡的fragment,想移都移不掉。

建議如果會要用到比較彈性的作法,可以直接在code裡面動態加fragment。

https://stackoverflow.com/questions/8903874/can-i-remove-a-fragment-defined-in-a-layout-xml-file


Solution

https://xnfood.com.tw/fragment02/

留言

這個網誌中的熱門文章

在Windows 10中 執行 Native Linux

Add to home 功能實作簡介