Android sliding page navigation: PagerSlidingTabStrip, context
Modify PagerSlidingTabStrip on github:
Tab text color selected color (the original text does not color), similar to navigation
Chestnuts: http://download.csdn.net/detail/onlyonecoder/7722021
PagerSlidingTabStrip custom attribute list:
pstsIndicatorColor
Color of the sliding indicator
pstsUnderlineColor
Color of the full-width line on the bottom of the view
pstsDividerColor
Color of the dividers between tabs
pstsIndicatorHeight
Height of the sliding indicator
pstsUnderlineHeight
Height of the full-width line on the bottom of the view
pstsDividerPadding
Top and bottom padding of the dividers
pstsTabPaddingLeftRight
Left and right padding of each tab
pstsScrollOffset
Scroll offset of the selected tab
pstsTabBackground
Background drawable of each tab, shocould be a StateListDrawable
pstsShouldExpand
If set to true, each tab is given the same weight, default false
pstsTextAllCaps
If true, all tab titles will be upper case, default true
Added the selectedTabTextColor attribute after modification.
If the default color is not set, it is the same as that of the pstsIndicatorColor.
Result code:
<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/org.lmw.demo.slidingtab"> <org.lmw.demo.slidingtab.widget.PagerSlidingTabStrip android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="40dp" app:pstsShouldExpand="true" app:pstsUnderlineHeight="2dp" app:pstsIndicatorHeight="2dp" app:pstsIndicatorColor="@android:color/holo_blue_light" app:selectedTabTextColor="@android:color/holo_blue_light" app:pstsDividerColor="@android:color/transparent" app:pstsTabBackground="@drawable/background_tab" android:background="@android:color/white" /> <android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/tabs" /></RelativeLayout>
How does one slide the android navigation bar (slide the slider along with the page), and there is a demo?
Simple Actionbar with ViewPager. In eclipse, you select a new Activity, blank activity, and then select ActionBar tabs with ViewPager in Navigation type. This will generate a demo for you.
In android development, how does one slide up and down, instead of ScrollView? What I want is to slide the entire page at a time, which is the same as the effect of horizontal slide.
Modify the code that moves horizontally. But I have to study it for a while.