Android action bar, Change color and add search function



Can you help me how to change the color of the action bar and how to add a search function (ic_search menu)


I am using API 14 and I also have the library v7 attached to my project


I have tried this for the color but it doesn't work ? My Style file



<resources>

<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:windowFullscreen">true</item>
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>






<!-- ActionBar styles -->
<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/orange_dark</item>
</style>



</resources>


my manifest:



<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />


<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />


<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" android:name=".gears.MyApplication">

<activity
android:name=".SplashScreen"
android:label="@string/title_activity_splash_screen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


<activity
android:name=".MainActivity"
android:label="@string/app_name" >
</activity>





</application>

</manifest>

No comments:

Post a Comment