Tuesday, 4 September 2018

'3 dots' on actionbar not showing

For some reason the 3 dots on the action bar aren't showing on my phone when I run my app on it. But when I run it on another phone which is of a bigger screen size and higher sdk version, the dots show and I can click on it etc..? I don't know why it's not working on my phone though.

Code:

 //creates the 3 buttons on the side.
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.create_menu, menu);
        return true;
    }

create_menu.xml

      <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android=
    "http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=  "com.app.supermarketaislefinder">

    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:title="Settings"
        app:showAsAction="never"

        />
</menu>

STYLES.xml v21 (for sdk > 21, so that I can set the colour of the status bar)

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>


    <style name="CreateTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorCreate</item>
        <item name="android:statusBarColor">@color/colorStatusCreate</item>

    </style>


    <style name="ViewTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorView</item>
        <item name="android:statusBarColor">@color/colorStatusView</item>


    </style>

</resources>

STYLES.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>


    <style name="CreateTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorCreate</item>

    </style>


    <style name="ViewTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorView</item>

    </style>

</resources>



from '3 dots' on actionbar not showing

No comments:

Post a Comment