gpt4 book ai didi

android - 与 SlidingUpPanel 中的 ViewPager 交互

转载 作者:行者123 更新时间:2023-11-29 15:18:23 24 4
gpt4 key购买 nike

我正在尝试使用 SlidingUpPanel来自 umano 并让 slider 成为 ViewPager。

但是,当试图左右滚动时,ViewPager 并没有移动。触摸事件似乎被 SlidingUpPanel 拦截了。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<com.sothree.slidinguppanel.SlidingUpPanelLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/slider_layout"
android:layout_gravity="bottom">

<!-- Top Panel -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
</LinearLayout>

<!-- Sliding Panel -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/pager">
</android.support.v4.view.ViewPager>

</LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

</RelativeLayout>

最佳答案

尝试:

  • 对 ViewPager 使用 setDragView 方法。
  • 使用 setEnableDragViewTouchEvents 以便 dragview/ViewPager 可以拥有自己的触摸事件。

或者,除了用于拖动的 ViewPager 之外,还可以创建一个单独的 View,并相应地将 DragView 设置为此 View,ViewPAger 应该单独接收触摸事件并可以处理它们。 (后者是我的做法并与其他布局一起工作)

关于android - 与 SlidingUpPanel 中的 ViewPager 交互,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21771256/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com