How to change color of bar in Android App? -


i'd change color of bar when use style:

<style name="appbasetheme" parent="@style/theme.appcompat.light" >         <item name="android:windownotitle">true</item>         <item name="android:windowactionbar">false</item>     </style> 

for example should looks system calculator in android 5, mean bar on top blue.

are speaking tool bar. if yes implement following xml in project:

?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:id="@+id/appbar"     android:background="@color/colorprimary"     app:theme="@style/mycustomtheme"      android:layout_width="match_parent"     android:layout_height="50dp">  </android.support.v7.widget.toolbar> 

in activity extend activity actionbaractivity, in oncreate() use following code:

toolbar toolbar = (toolbar) findviewbyid(r.id.appbar);         setsupportactionbar(toolbar); 

make sure give blue color colorprimary attribute in colors.xml file or can directly give blue color value if not using colors.xml file.


Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -