嗨,我希望有人能夠從閱讀本網站清除一些混亂我有(4.2節)http://www.vogella.com/tutorials/AndroidFragments/article.html 和一些代碼,我通過YouTube https://www.youtube.com/watch?v=oN2AAhaOBf8Android的工作室多片段於1個活動實施
我的問題可見兩個片段......但你只想一次看到一個片段。在activity_main xml文件中,而不是有
<fragment
android:id="@+id/message_fragment"
android:name="com.example.android.fragments.MessageListViewFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="top" />
<fragment
android:id="@+id/send_fragment"
android:name="com.example.android.fragments.SendMessageFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom" />
我應該用FrameLayout替換每個片段嗎?或者我只是有一個FrameLayout ...我已經看到兩個,不知道哪一個是正確的。謝謝,我只是想了解..從研究我假設FrameLayout只允許一個片段出現在一次?
沒關係,所以在一個片段下1使其可見,而fragment2不可見,那麼它是什麼意思子視圖? – Nameishi
你是說通過改變片段到FrameLayout將不會有所作爲一次看到一個片段? – Nameishi
是的,通過上面的說明,在佔據整個父母的時間只有一個視圖可見。 – Jaydev