ฉันมีกิจกรรมที่ใช้แถบเครื่องมือยุบ เค้าโครงมีลักษณะดังนี้ (ละเว้นสิ่งที่ไม่เกี่ยวข้อง):
<DrawerLayout ...>
<FrameLayout>
<CoordinatorLayout>
<AppBarLayout>
<CollapsingToolbarLayout
app:layout_scrollFlags="scroll|exitUntilCollapsed" ...>
<Toolbar
app:layout_scrollFlags="scroll|enterAlways" .../>
</CollapsingToolbarLayout>
</AppBarLayout>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</CoordinatorLayout>
</FrameLayout>
</DrawerLayout>
ใน onCreate()
ของกิจกรรม ฉันสร้างส่วนย่อยและแทนที่ fragment_container
ด้วย:
TabHostFragment f = new TabHostFragment();
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.fragment_container, f)
.commit();
เค้าโครง TabHostFragment
s เป็นเพียง ViewPager
ซึ่งเต็มไปด้วยหลายแฟรกเมนต์ ชิ้นส่วนเหล่านี้บางส่วนมีมุมมองการรีไซเคิล ตอนนี้ เมื่อฉันเลื่อนมุมมองผู้รีไซเคิลขึ้นและลง แถบเครื่องมือจะไม่ตอบสนองเลย ฉันจะทำให้แถบเครื่องมือหายไปเมื่อเลื่อนลงและปรากฏขึ้นอีกครั้งเมื่อเลื่อนขึ้นได้อย่างไร
app:layout_behavior="@string/appbar_scrolling_view_behavior"
ใน RecyclerView แล้วหรือยัง - person Roman Kolomenskii   schedule 23.01.2017