我想在带有3个标签的标签式布局中实现“滑动解锁”小部件(https://github.com/ebanx/swipe-button 0.4.0)。 在滑动小部件本身时,它正在更改标签。
即使将小部件保留在最左侧的选项卡上,然后向右滑动也会产生类似的结果(尝试切换到下一个不存在的左侧选项卡,即显示选项卡/布局提示的结尾),请参阅图像以获得更好的视觉理解
我有什么方法可以实现这一点,在哪里滑动会导致滑动小部件而不是制表符?
Image for 'On Swiping on the widget'
左标签XML:
<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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<com.ebanx.swipebtn.SwipeButton
android:id="@+id/SwipeButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_centerInParent="true"
app:inner_text="Swipe TO Unlock"
app:inner_text_background="@color/black"
app:inner_text_color="@color/white"
app:inner_text_size="16sp"
app:inner_text_bottom_padding="18dp"
app:inner_text_top_padding="18dp"
app:button_image_disabled="@drawable/ic_lock_open_black_24dp"
app:button_image_enabled="@drawable/ic_lock_outline_black_24dp"
app:button_left_padding="20dp"
app:button_right_padding="20dp"
app:button_top_padding="20dp"
app:button_bottom_padding="20dp"
app:button_background="@drawable/round_button" >
</com.ebanx.swipebtn.SwipeButton>
选项卡式活动的XML
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:weightSum="10"
android:background="#1D1D1D"
tools:context="com.digitalcrafts.tjay.trailindiactor.TabbedActivity">
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="9"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />