astuetz / PagerSlidingTabStrip

An interactive indicator to navigate between the different pages of a ViewPager
139 stars 44 forks source link

Can we remove background long press color of tab? #300

Open PriyankaKamthe opened 7 years ago

PriyankaKamthe commented 7 years ago

I am implementing PagerSlidingTabStrip and everything is working nicely. But when i long pressed on tab, background color of tab gets blueish for a while. I just want to remove it. Its looks like; issue1

I also tried to set selector as tab background

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Active tab -->
    <item
        android:state_selected="true"
        android:state_focused="false"
        android:state_pressed="false"
        android:drawable="@color/Orange" />
    <!-- Inactive tab -->
    <item
        android:state_selected="false"
        android:state_focused="false"
        android:state_pressed="false"
        android:drawable="@color/gray" />
    <!-- Pressed tab -->
    <item
        android:state_pressed="true"
        android:drawable="@color/white" />

    <!-- Selected tab (using d-pad) -->
    <item
        android:state_focused="true"
        android:state_selected="true"
        android:state_pressed="false"
        android:drawable="@android:color/transparent" />
</selector>

But Still tab gets blueish when i long press on tab.

Following is my main_activity.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <com.astuetz.PagerSlidingTabStrip
        android:id="@+id/tabbedDashboardTabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@android:color/darker_gray"
        android:paddingBottom="10dp"
        android:paddingTop="10dp"
        android:textColor="#fff"
        android:textSize="18sp"
        app:pstsDividerColor="@android:color/white"
        app:pstsDividerPadding="0dp"
        app:pstsIndicatorColor="@android:color/holo_red_dark"
        app:pstsIndicatorHeight="80dp"
        app:pstsShouldExpand="true" />

    <android.support.v4.view.ViewPager
        android:id="@+id/dashboardTabPager"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@+id/tabbedDashboardTabs"
        android:scrollbarAlwaysDrawVerticalTrack="true" />

</RelativeLayout>

Please provide suitable solution.

ka05 commented 6 years ago

@PriyankaKamthe Have you found a way to do this yet? I would also like to know. I also tried the selector drawable for setTabBackground() and no dice.

PriyankaKamthe commented 6 years ago

@ka05 sorry for late reply. I don't find any solution for this but i find out hack to solve my problem.I kept PagerSlidingTabStrip height as constant value like 50dp or something instead of 'wrap_content'.