我有一個活動,其中包含一個包含三個項目,單擊時切換三個片段。所以,我想要在我的第一個片段中加入另外三個片段,我用.bottomNavigationBarappBarLayout我已經(jīng)設(shè)置好了一切,但我遇到的問題是我的片段和沒有按預(yù)期工作。似乎在我切換圖標后,我失去了與內(nèi)部片段的連接。我得到了什么。錯?viewPagerappBarLayoutappBarLayoutbottomBaractivity_main.xml<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:background="@color/colorPrimary" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentTop="true"> <ImageView android:layout_width="30dp" android:layout_height="30dp" android:tint="@android:color/white" android:layout_marginEnd="20dp" android:layout_marginRight="20dp" android:src="@drawable/transactions" android:contentDescription="@string/logo" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="15dp" android:ellipsize="end" android:text="@string/_1_dollar_pay" android:textColor="@android:color/white" android:textSize="16sp" app:fontFamily="@font/carter_one" /> </android.support.v7.widget.Toolbar> <View android:id="@+id/shadow" android:layout_width="match_parent" android:layout_height="5dp" android:layout_below="@+id/toolbar" android:background="@color/colorPrimary"/> }
1 回答

幕布斯6054654
TA貢獻1876條經(jīng)驗 獲得超7個贊
在創(chuàng)建新的 .getChildFragmentManager()PagerAdapter 時使用
PagerAdapter pagerAdapter = new PagerAdapter(getChildFragmentManager(), tabLayout.getTabCount());
添加回答
舉報
0/150
提交
取消