第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

片段在初次啟動時或從其他活動返回后具有空白內容

片段在初次啟動時或從其他活動返回后具有空白內容

達令說 2021-05-14 19:14:22
我有一個帶有兩個選項卡(第一個選項卡,第二個選項卡)的應用程序。但是,在啟動或從另一個活動返回時,第一個選項卡的片段為空白。只有在我單擊第二個選項卡然后單擊第一個選項卡后,才會顯示該片段。另一個問題,是否有辦法在初次啟動時顯示第二個選項卡而不是第一個選項卡?    //protected void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentView(R.layout.layout_tab_base);    simpleFrameLayout = findViewById(R.id.simpleFrameLayout);    tabLayout = findViewById(R.id.simpleTabLayout);    TabLayout.Tab firstTab = tabLayout.newTab();    firstTab.setText("Income");    tabLayout.addTab(firstTab);    TabLayout.Tab secondTab = tabLayout.newTab();    secondTab.setText("Expenses");    tabLayout.addTab(secondTab);    // I try to set the fragment but startup but no effect    if (fragment==null)        fragment = new IncomeTab();    tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener()       {        @Override        public void onTabSelected(TabLayout.Tab tab) {            switch (tab.getPosition()) {                case 0:                    fragment = new IncomeTab();                    break;                case 1:                    fragment = new ExpenseTab();                    break;            }            FragmentManager fm = getSupportFragmentManager();            FragmentTransaction ft = fm.beginTransaction();            ft.replace(R.id.simpleFrameLayout, fragment);            ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);            ft.commit();        }                });}
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 144 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號