【发布时间】:2011-09-22 11:49:50
【问题描述】:
我一直在尝试隐藏/显示片段并添加另一个片段。 这是xml
<FrameLayout
android:id="@+id/frag_content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
class="com.tugce.MitsActionBar.KartvizitFragment"
android:id="@+id/frag_kartvizit"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</FrameLayout>
在调用其他东西并再次调用此片段后,它的 mAdded 属性为 false,因此当我尝试访问 getView() 时,它为空。
我尝试了这篇文章中的所有编辑:Android Honeycomb: How to change Fragments in a FrameLayout, without re-creating them? 但仍然无法使其工作。
【问题讨论】:
-
好像fragment被添加到视图中但没有看到,并且没有隐藏