android - Android 中的自定义可滑动 View

标签 android swipe-gesture

我想创建一个可滑动的 View 来显示用户状态。当用户滑动时,状态应该从 Activity 状态变为非 Activity 状态,反之亦然。我希望此 View 的高度最大为 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" />

关于android - Android 中的自定义可滑动 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33493569/

相关文章:

ios - 在 UITableviewCell 上滑动手势就像 Whatsapp 为 "Reply a Message"所做的那样

java - Camera2 API 使预览填充整个 View

android - 三星s4 zoom不支持平滑缩放isSmoothZoomSupported()==false

android - 如何在通知中心设置 GCM/FCM 负载的生存时间

cocoa - 需要在非按键窗口接收滑动事件

android - SwipeDismissTouchListener 在滑动后调用 onClickListener

android - 如何从Aosp launcher3的左侧页面中删除Qbs容器

android - 从经纬度到latitudeE6, longitudeE6

objective-c - Xcode:如何使用滑动手势更改 UIPageControl 值?

css - 将触摸/滑动命令添加到 CSS 转换/动画