Added setTabLongClickListener(...)
parent
074f064323
commit
64e13276fa
|
@ -77,6 +77,8 @@ public class SlidingTabLayout extends HorizontalScrollView {
|
||||||
|
|
||||||
private final SlidingTabStrip mTabStrip;
|
private final SlidingTabStrip mTabStrip;
|
||||||
|
|
||||||
|
private OnLongClickListener tabLongClickListener = null;
|
||||||
|
|
||||||
public SlidingTabLayout(Context context) {
|
public SlidingTabLayout(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
}
|
}
|
||||||
|
@ -114,6 +116,16 @@ public class SlidingTabLayout extends HorizontalScrollView {
|
||||||
mDistributeEvenly = distributeEvenly;
|
mDistributeEvenly = distributeEvenly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the listener for long clicks on tabs
|
||||||
|
* Should be set before calling {@link #setViewPager(ViewPager)}
|
||||||
|
*
|
||||||
|
* @param longClickListener The listener
|
||||||
|
*/
|
||||||
|
public void setTabLongClickListener(OnLongClickListener longClickListener) {
|
||||||
|
this.tabLongClickListener = longClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the colors to be used for indicating the selected tab. These colors are treated as a
|
* Sets the colors to be used for indicating the selected tab. These colors are treated as a
|
||||||
* circular array. Providing one color will mean that all tabs are indicated with the same color.
|
* circular array. Providing one color will mean that all tabs are indicated with the same color.
|
||||||
|
@ -213,6 +225,7 @@ public class SlidingTabLayout extends HorizontalScrollView {
|
||||||
|
|
||||||
tabTitleView.setText(adapter.getPageTitle(i));
|
tabTitleView.setText(adapter.getPageTitle(i));
|
||||||
tabView.setOnClickListener(tabClickListener);
|
tabView.setOnClickListener(tabClickListener);
|
||||||
|
tabView.setOnLongClickListener(tabLongClickListener);
|
||||||
String desc = mContentDescriptions.get(i, null);
|
String desc = mContentDescriptions.get(i, null);
|
||||||
if (desc != null) {
|
if (desc != null) {
|
||||||
tabView.setContentDescription(desc);
|
tabView.setContentDescription(desc);
|
||||||
|
|
Loading…
Reference in New Issue