android


SlidingTabLayout text & background color customization


first of all, when I select a tab, it only changes its color while I press it, but after the tab is selected the color stays as the color of unselected state.
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="#color/white" />
<item android:state_focused="true" android:color="#color/white" />
<item android:state_pressed="true" android:color="#color/white" />
<item android:color="#color/black" />
</selector>
populateTabStrip() method:
tabTitleView.setTextColor(getResources().getColorStateList(R.color.tab_text_color_selector));
Secondly, the background of the tab .. I can't figure out how to use a selector here.
** getColorStateList is deprecated, so any suggestions of replacing it would be welcome.
try that also please
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
#Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
#Override
public void onPageSelected(int position) {
switch (position){
case 0:
tabLayout.setTabTextColors(ColorStateList.valueOf(Color.CYAN));
break;
case 1:
tabLayout.setTabTextColors(ColorStateList.valueOf(Color.GREEN));
break;
case 2:
tabLayout.setTabTextColors(ColorStateList.valueOf(Color.YELLOW));
break;
}
}
#Override
public void onPageScrollStateChanged(int state) {
}
});
try this please
tabLayout.setTabTextColors(ColorStateList.valueOf(Color.WHITE));

Related Links

Azimuth in android
How to add elements to multidimensional arrayList
android bluetooth application unresponsive during phone call
Parse a local xml file and show parsed data in web-view
How to prevent to ViewPager shows next page if next page is creating still in Android
Inapp Billing in android
why is invalidate not working?
Android: Adding Android library as maven dependency in project
How to set active item in the Action Bar drop-down navigation?
Run time errors in eclipse for android.
android.app.Application cannot be instantiated due to NullPointerException
Use HDPI Resources on Kindle Fire
Possible to change app icon without recompiling the APK?
ndk-build keeps rebuilding all sources
How to scale down image for multiple screens?
Faster Deploy and Start on Android

Categories

HOME
cygwin
string
alexa-skills-kit
edge
yandex
cublas
rom
big-o
banner
arangodb
syntaxnet
jquery-ui-sortable
octave
resultset
why3
gource
smartclient
bourbon
oledb
cgbitmapcontext
php-mysqlidb
aggregation
resourcebundle
roundup
xunit
pic32
asymptotic-complexity
firebase-analytics
soot
errbot
failover
cognos-bi
quickfixj
indy10
salesforce-communities
reactivekit
protein-database
google-data-api
p4merge
ogc
plaintext
android-ibeacon
avcapturedevice
ntvs
openblas
qtranslate
gpg-signature
d3-force-directed
cmp
renaming
javafx-css
pytables
pacemaker
greatest-n-per-group
lean
kiosk
uiactionsheet
realsense
concept-insights
inf
custom-errors
microsoft-reporting
text-search
rpart
rdflib
airbrake
telepat
uncaught-typeerror
webfinger
cocos3d
psr-4
mintty
menubar
high-resolution
jammer
kogrid
abstract-data-type
octal
frameworkelementfactory
xcode3.2
thttpd
lambdaj
relative
node-redis
automationelement
mbeans
strsep
msr
drupal-fivestar
build-environment
dsl-tools
dojo-dnd
alsb
xpsdocument
fail-fast-fail-early

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App