1

I want to implement "Swipe to Unlock" widget (https://github.com/ebanx/swipe-button 0.4.0) in a tabbed layout with 3 tabs. While swiping on the widget itself it is changing tabs.

Even after keeping the widget on the left most tab, and then swiping to the right is resulting in similar outcomes (tries to switch to the next left tab which is not present i.e. shows end of tabs/layout hint),See the images for better visual understanding

Is there any way I can accomplish that, where swiping results in swiping of widget not tab?

Image for in 'Idle Position'

Image for 'On Swiping on the widget'

Left Tab 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>

Tabbed Activity's 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" />

  • 2
    Please, post some source code for better understand. – jantursky May 23 '18 at 07:08
  • @jantursky I've added the screenshots for better understanding, – Valley Wood May 23 '18 at 07:36
  • If you will put the whole swipe button in the layout of the Activity itself, doesn't that help? So, because that was the reason, why I asked you for the xml source code of the activity and the tab itself. – jantursky May 23 '18 at 07:39
  • @jantursky I've added the XML, Are you saying to implement the swipe button in Tabbed Activity's Layout instead of left Tab?? – Valley Wood May 23 '18 at 10:42
  • Yes, that should help. So just move that swipe button to Tabbed Activity XML and change from LinearLayout to FrameLayout and you'll see. – jantursky May 23 '18 at 11:24
  • @jantursky I did as you suggested, as I only want in a single tab (out of three), I have had to hide it from rest of tabs, which I'm doing currently by "SwipeWiddget.setVisibility(GONE)", which is resulting in not so good animation on swiping(It is pooping up in the middle), is there any alternative? – Valley Wood May 25 '18 at 11:48
  • @ValleyWood Did you get this resolved? – Hiago Souza Nov 16 '19 at 19:08

0 Answers0