0
我有3個碎片 - a,b和c。 片段a顯示了一些項目,片段b與片段a相同,片段c包含3個選項卡。當我打開片段A - > b - > c並返回到片段b並再次打開片段c,然後爲每個選項卡調用onCreateView,不會調用並且所有選項卡均爲空。誰能幫幫我嗎?Android碎片背板和標籤
我有3個碎片 - a,b和c。 片段a顯示了一些項目,片段b與片段a相同,片段c包含3個選項卡。當我打開片段A - > b - > c並返回到片段b並再次打開片段c,然後爲每個選項卡調用onCreateView,不會調用並且所有選項卡均爲空。誰能幫幫我嗎?Android碎片背板和標籤
有些東西你不會在片段c的onResume中做,這是選項卡內容所必需的。所以事實上在這種情況下沒有做任何事情,因爲c只是暫停了!所以我的建議做:
@Override
public void onResume(){
super.onResume();
//Paste the same code you have and used in onCreateView() and run again.
//If nothing happens override onStart and do the same thing!
//else post some codes so that we can easily figure where the problem is..
}
你說你是顯示沒有創造所以檢查的onResume(),並在onPause() – zombie
其中片段c具有標籤 – user3099678
標籤像ViewPager或TabHost? – zombie