Android Swipe page navigation effect: Pagerslidingtabstrip

Source: Internet
Author: User

Make a slight change to the Pagerslidingtabstrip on GitHub:

tab text color selected color change (original text does not change color)


Chestnut: http://download.csdn.net/detail/onlyonecoder/7722021


Pagerslidingtabstrip a custom attribute list:

  • pstsIndicatorColorColor of the sliding indicator
  • pstsUnderlineColorColor of the Full-width line on the bottom of the view
  • pstsDividerColorColor of the dividers between tabs
  • pstsIndicatorHeightHeight of the sliding indicator
  • pstsUnderlineHeightHeight of the Full-width line on the bottom of the view
  • pstsDividerPaddingTop and bottom padding of the dividers
  • pstsTabPaddingLeftRightLeft and right padding of each tab
  • pstsScrollOffsetScroll offset of the selected tab
  • pstsTabBackgroundBackground drawable of each tab, should is a statelistdrawable
  • pstsShouldExpandIf set to True, all tab is given the same weight, default false
  • pstsTextAllCapsIf True, all tab titles are upper case, default True
A property is added after the modificationSelectedtabtextcolor

If you do not set the default and slide indicator colors (pstsindicatorcolor) consistent


The code for the effect:


<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=" H Ttp://schemas.android.com/apk/res/org.lmw.demo.slidingtab "> < Org.lmw.demo.slidingtab.widget.PagerSlidingTabStrip android:id= "@+id/tabs" android:layout_width= "Match_paren T "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=" @drawabl        E/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> 




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.