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

How to get Data from Realm for my ListView
Multi-layer / libraries architecture with dagger2: designing scopes, components, modules
Can not send request to server on tab change
Fragment detached from activity without any obvious reason
Explicit Intent Errors while working with putExtra()
showing a specific output on alertdialog based on what is saved in sharedPreferences
Scroll a RecyclerView when scrolling second one
Firebase auth with an active session when the user id was deleted from the console
Upload image to wordpress via Android
Android. How to clone newest version of Google Calendar?
Align 2 textviews horizontally android
Loading Pictures from URL to imageviews in a ListView
Reducing size of res folder in Android (Multi-language Support)
How to JobScheduler work
How to have a same retrofit client using two rest endpoints at a same time depending on the api getting called
AlertDialog Builder: add event on click outside the dialog

Categories

HOME
hyperlink
c++11
webdriver
gpu
rdbms
angular-formly
zend-framework
camera
error-handling
ms-access-2016
webix
qpython
syntaxnet
g++
siddhi
xcodebuild
ipmitool
stellar.js
comsol
shared-libraries
enterprise-architect
docx
bitnami
gruntfile
event-sourcing
pyramid
identity-management
symfony-console
jmp
nim
articulate-storyline
rubymotion
href
systemtime
string-concatenation
tosca
resourcebundle
google-cloud-print
beautifier
flooding
nstimer
angular-translate
tpm
carrierwave
corenlp-server
login-script
android-maps-extensions
openwhisk
imx6
password-protection
dcmtk
print-css
bindingnavigator
knime
file-sharing
dynamic-linq
openal
magento-2.0.7
wcftestclient
x-ray
amq
mouseleave
pybrain
vcloud-director-rest-api
slackware
usart
grails-plugin
autosar
google-cloud-console
spring-cloud-feign
vorpal.js
xdoclet
respondcms
omniauth-facebook
hadoop-partitioning
thread-sleep
toran-proxy
qt5.2
themoviedb-api
avisynth
file-move
vigenere
opserver
extjs-grid
pax-exam
canalyzer
vacuum
rdflib
graphics2d
aspectj-maven-plugin
at-job
koala
sbcl
ecslidingviewcontroller
kendo-dataviz
ie8-compatibility-mode
windows-phone-8-sdk
kaleidoscope
pclzip
traceability
windows-98
stacky
midlet
nokia-s40
dajaxice
subgraph
usertype
failing-tests
hibernateexception
expression-blend-4
user-tracking
u2netdk
winmain
xcelsius
cdonts
collectionviewsource
uideviceorientation
office-2007
request-headers
appliance

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