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 it possible to draw a layout and convert to bitmap without being visible
Sending live video stream to wowza streaming engine with Android devices
Volley exception error when response code 304 and 200
NoClassDefFoundError when inserting image in Android app using Apache poi & MS Excel
Wrong size of bitwise struct
Set time appearance for Toast.makeText
StackView like gallery in android
Can't get the cityname of a particular area in android google map
How to get Activity in Intent Service
Supporting all screen sizes in android?
English to lingo and lingo to english conversion [closed]
Action Bar Select All/Cut/Copy not showing for alert dialog
How to make return to previous Activity with on back pressed?
TEXTVIEW Click is not working in android
How to have data accessible from one android app's database to another app?
Corona SDK native.playVideo() can not play video on several Android devices

Categories

HOME
codenvy
dns
formal-languages
case
jmx
mysql-workbench
battery
hessian
oracle-apex-5
spring-data-redis
error-handling
pclxl
can
javacc
rds
hugo
g++
octave
reactive-programming
android-securityexception
emoji
selenium-ide
symmetricds
scrolltop
magnetic-cards
cumulocity
event-sourcing
entitymanager
topology
ag
named-entity-recognition
string-concatenation
event-store
ckfinder
onload
moses
angularjs-components
android-maps
wcag
magento-1.8
quickfixj
jett
classcastexception
python-import
apiary.io
openerp-7
parse-tree
docfx
modernizr
wmp
softmax
jide
fwrite
dynamic-linq
activeperl
stdmap
boxing
spring-data-couchbase
sandcastle
testrail
visual-studio-2008-sp1
mapxtreme
hadoop-2.7.2
latin
vulcanize
i386
query-by-example
spreadjs
fink
nullable
aspen
toast
phpgrid
microsoft-reporting
phonertc
coda
haskell-warp
sha512
canvg
git-ftp
snackbar
entity-framework-4.3
umlgraph
delayed-execution
primitive-types
addressing-mode
create.js
kissfft
personalization
malformedurlexception
functional-java
renderer
drupal-nodes
git-repo
gd-graph
sphinxql
oocss
gpars
insert-id
swfobject
saleslogix
wcf-configuration
kqueue
virtualpathprovider
user-tracking
screen-size
cgbitmapcontextcreate
unattended-processing
murmurhash
lxr
strtod
lobo-cobra
google-wave
mathematical-typesetting

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