0

I stetted custom action-bar to my activity, after adding custom action-bar it is displaying on top correctly but the default action-bar is still displaying next to custom action-bar. See the below screenshot I want to remove that black action-bar if anyone knows about this please help me here

I refereed this link to add custom action-bar

Please refer below screenshot I want to remove dark action-bar

please refer this screenshot I want to remove dark action-bar

madhan kumar
  • 1,560
  • 2
  • 26
  • 36
Rajappa R
  • 31
  • 2
  • 14
  • 1
    Make your app theme inherit from Theme.AppCompat.Light.NoActionBar or from Theme.AppCompat.NoActionBar – MidasLefko Aug 04 '16 at 14:12
  • Theme.AppCompat.Light.NoActionBar it showing like that @MidasLefko – Rajappa R Aug 05 '16 at 05:37
  • Possible duplicate of [How to Set a Custom Font in the ActionBar Title?](http://stackoverflow.com/questions/8607707/how-to-set-a-custom-font-in-the-actionbar-title) – Rajappa R Feb 09 '17 at 10:33

3 Answers3

1

add this to your styles.xml file

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat.Light">
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item> <!-- For 2.x version  -->
    </style>
</resources>

and use that theme in your manifest file

android:theme="@android:style/Theme.AppCompat.Light.NoActionBar" 
Matias Elorriaga
  • 8,880
  • 5
  • 40
  • 58
1

you have to make your activity theme in the AndroidManifest.xml

<activity
        android:name="YOUR ACTIVITY NAME"
        android:theme="@style/AppTheme" />

set style in res/values/styles.xml

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"/>
1

Firstly, if you want a custom Action Bar as a beginner, I would recommend using the Toolbar widget. It works as a regular widget, that replaces the Action Bar. Once you've put the Toolbar widget in your layout, you should set it as a support action bar, in your onCreate method:

Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
setSupportActionBar(myToolbar);

This works only if you're using the AppCompatActivity as a base of your Activity. If not, you'll have to rework it.

After you've extending AppCompatActivity instead of Activity, you should change your theme, to a .NoActionBar version, such as Theme.AppCompat.Light.NoActionBar, so that the system does not supply an Action Bar by itself, but rather uses the one you created (you'll get an error if you don't do this).

Once you've done this, it should work!

Aleksandar Stefanović
  • 1,583
  • 2
  • 20
  • 36