嘗試用 `ViewPager` 的 `onPageScrolled` 實現左滑出菜單,類似 QQ/CSDN 效果。
Android 官方提供 `android.support.v4.widget.DrawerLayout`(現 `androidx.drawerlayout.widget.DrawerLayout`),專為側滑抽屜設計,功能完善、性能優、適配好。
<DrawerLayout xmlns:android="..."
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- 主內容 -->
<FrameLayout android:id="@+id/content_frame" ... />
<!-- 側滑菜單 (通常放左側) -->
<ListView android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start" />
</DrawerLayout>
新建 Activity 時選 **Navigation Drawer Activity**,自動生成完整樣板代碼(含 Toolbar、ActionBarDrawerToggle、菜單列表)。