Android 中的自定义可滑动视图

Custom Swipeable View in Android

我想创建一个可滑动的视图来显示用户状态。当用户滑动时,状态应该从活动状态变为非活动状态,反之亦然。我希望此视图的高度最大为 70-80 dp。 我怎样才能实现这种行为??

您可以使用 ViewPager .

It have built-in swipe gestures to transition through pages, and they display screen slide animations by default, so you don't need to create any. ViewPagers use PagerAdapters as a supply for new pages to display .

<android.support.v4.view.ViewPager
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />