android


Android color status bar


I would like to change color of my status bar. But everything I have tried didnt work.
values
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:statusBarColor">#color/colorPrimaryDark</item>
</style>
values-v21
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:statusBarColor">#color/colorPrimaryDark</item>
</style>
manifest
android:theme="#style/Theme.AppCompat.Light.NoActionBar">
You have to implement it from java if you're using lower then 21st API in you application, just try the following code to change your status bar's color
Window window = activity.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(activity.getResources().getColor(R.color.my_statusbar_color));
one more thing, this code will not work if you extending AppCompatActivity in your activity, it will work only with Extends Activity

Related Links

Is there a way to fetch my app's latest reviews and stars in google play through api?
Parse push notification not appearing as System Tray notification on Android (Cordova app)
Tool to share build path or apk in android
facebook - recover from CLOSE_LOGIN_FAILED when user hits cancel button
Android: findViewById function in different class and different package
Implementing viewpager
Use Activity functions in no activity class
Process: com.android.packageinstaller OutOfMemoryError
issue on check boxes inside listview's every child item in android
How to implement checkbx with custom listview
4.2.2 - 4.4.2 Service Error
Jodatime issues on Android 5.0
Android Watch Face Development
compile android-support:support-annotations in java module. is it possible?
Seeing with sound software
Using HashMap to load image for specific marker crashes

Categories

HOME
grok
google-cloud-platform
c99
wakanda
rdbms
pyqt
numbers
nuget
cq5
flume
pattern-matching
android-securityexception
angular-dart
radgridview
heat
http-post
symfony-console
simpleitk
symbols
spring-async
cgbitmapcontext
delimiter
fractions
genexus-sd
zend-debugger
mustache
getpixel
lubridate
roblox
video-capture
salesforce-communities
jpad
bc
health-monitoring
metawidget
mongoose-schema
signals-slots
glm-math
logback-groovy
contract
knime
wc
fwrite
gitlist
activeperl
zenhub
aquamacs
scalding
css-transforms
libjpeg
sandcastle
chromium-os
angular2-testing
atlas
actor-platform
myspace
installshield-2010
simevents
android-wake-lock
jaunt-api
iokit
opserver
ember-cli-rails
osc
umlgraph
ghcjs
contrast
iso-prolog
webfinger
genymotion-call
ss7
jquery-slider
file-not-found
mt4j
inputmismatchexception
mvc-editor-templates
cnf
scmmanager
video-codecs
superscrollorama
server-administration
http-status-code-410
uimanageddocument
vfs
inkcanvas
cross-database
fsevents
xcelsius
strsep
quotation-marks
presentation-layer
product-management
contentpresenter

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