crysis21 / pagertabindicator Goto Github PK
View Code? Open in Web Editor NEWA revived ViewPager tab bar for Android
License: Apache License 2.0
A revived ViewPager tab bar for Android
License: Apache License 2.0
I need to change tab text on page selection change, so for that i need listener to set updated text on page change. I don't know how to implement this using PagerTabIndicator.
Previously I was using com.astuetz.PagerSlidingTabStrip but since Its giving problem in Android studio 3.0 so I switched to com.hold1:pagertabindicator:1.0.2.
In PagerSlidingTabStrip there is listener called setOnPageChangeListener which having 3 methods by using them I am able to change tab text dynamically on page change. but now i need to implement same by using com.hold1:pagertabindicator:1.0.2.
Without me having to dig through two codebases, is there a quick and dirty comparison between the properties between PagerSlidingTabStrip and PagerTabIndicator?
I'm trying to sort out pstsTabBackgroundResIds
for example, and I can't quite get my tab collection to go across the entire bottom of the view.
Basically, I'm seeing if I can switch from this layout fragment:
<com.astuetz.PagerSlidingTabStrip
android:id="@+id/bottombar"
android:layout_width="match_parent"
android:layout_height="60dp"
app:pstsDividerPadding="0dp"
app:pstsIndicatorHeight="60dp"
app:pstsIndicatorColor="@color/text_grey_500"
app:pstsShouldExpand="true"
app:pstsTabBackgroundResIds="@array/setting_tab_backgrounds"
app:pstsTextAllCaps="false" />
For some reason I'm unable to sync my Gradle with this implementation. is there anything special I need to know or understand when importing this into my android studio project? I have maven central and many other libraries, but for some reason yours 'fails to resolve'.
implementation 'com.hold1:pagertabindicator:1.0.7'
I need to change the only selected tab text color with remaining tab text should be same color
The tab text is cutting not displaying properly. Similar feature available on pagerslidingtabstrip (should_expand) which is working as expected. Please fix it. This is library is very useful for me. Other than pagerslidingtabstrip library isn't working after upgrading sdk.
Alternatively can you add text typeface function?
When i tried to run application Its giving me following error; but When I run application in debug mode its runs perfectly.
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getLeft()' on a null object reference
at com.hold1.pagertabsindicator.PagerTabsIndicator.drawIndicator(PagerTabsIndicator.java:332)
at com.hold1.pagertabsindicator.PagerTabsIndicator.onDraw(PagerTabsIndicator.java:317)
at android.view.View.draw(View.java:17185)
at android.widget.HorizontalScrollView.draw(HorizontalScrollView.java:1643)
at android.view.View.updateDisplayListIfDirty(View.java:16167)
at android.view.View.draw(View.java:16951)
at android.view.ViewGroup.drawChild(ViewGroup.java:3727)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3513)
at android.view.View.updateDisplayListIfDirty(View.java:16162)
at android.view.View.draw(View.java:16951)
at android.view.ViewGroup.drawChild(ViewGroup.java:3727)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3513)
at android.view.View.updateDisplayListIfDirty(View.java:16162)
at android.view.View.draw(View.java:16951)
at android.view.ViewGroup.drawChild(ViewGroup.java:3727)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3513)
at android.view.View.updateDisplayListIfDirty(View.java:16162)
at android.view.View.draw(View.java:16951)
Following is way i implement PagerTabsIndicator;
In xml;
<com.hold1.pagertabsindicator.PagerTabsIndicator
android:id="@+id/transactionTabs"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="#FBE9E9EC"
app:tab_indicator="bottom_bar"
app:tab_indicator_bg_color="#FBE9E9EC"
app:tab_lock_expanded="true"
app:tab_divider_color="@color/colorPrimary"
app:tab_indicator_color="@color/drawerBgColor"
app:tab_indicator_height="80dp"
/>
In Activity;
tabPagerAdapter = new TransactionTabPagerAdapter(getSupportFragmentManager(),userTransactionResDTO,this);
mPager.setAdapter(tabPagerAdapter);
mTabStrip.setViewPager(mPager);
To change Tab text color dynamically I used;
if (position==0) {
mTabStrip.setTextColor(getResources().getColor(R.color.colorPrimary));
} else {
mTabStrip.setTextColor(Color.BLACK);
}
In gradle;
compile 'com.hold1:pagertabindicator:1.0.5'
Hello, thanks for this lib, it is really nice, i found an issue, please have a look
to reproduce
if(this.targetPosition == -1) { this.scrollToChild(position, (int)(positionOffset * (float)this.tabsContainer.getChildAt(position).getWidth())); }
BTW, i found that the fragement will be resued unless I use FragmentStatePagerAdapter to be the base class of my adaption and with below also
public int getItemPosition(Object object) { return POSITION_NONE; }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.