1

There are lots of questions regard my problem but I believe I'm following those answers but still when I launch the application my item is not visible (it's under over flow menu).

This my menu.xml

<menu
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".MainActivity">

    <item
        android:id="@+id/action_sort_asc"
        app:showAsAction="always"
        android:title="@string/action_sort"
        android:icon="@drawable/ic_arrow_down"/>

...

MainActivity extended Activity and not ActionBarActivity. Although Android studio preview shows it in Actionbar (and other items inside overflow), however, this item is not visible when I launch the app.

Any idea would be appreciated. Thanks.

3
  • try to Extends FragmentActivity
    – M D
    Commented Feb 3, 2015 at 9:49
  • @M D, Nop, is still under overflow menu :(
    – Hesam
    Commented Feb 3, 2015 at 9:51
  • Just remove app:showAsAction and try android:showAsAction="ifRoom" . It's perfect working in my case.
    – M D
    Commented Feb 3, 2015 at 9:52

1 Answer 1

3

I faced this problem once , try adding android:showAsAction="always" too

3
  • that's working fine but have no idea why Editor display error and ask to use xmlns:app="http://schemas.android.com/apk/res-auto".
    – Hesam
    Commented Feb 3, 2015 at 9:53
  • 1
    i don't know what causes this behaviour but if it makes you feel better try adding tools:ignore="AppCompatResource"
    – arash sc
    Commented Feb 3, 2015 at 9:55
  • that would ignore that line. basically when you're using app:showAsAction , you're using the support's library definition and when you're using the android:showAsAction you're using the current sdk one, which may be not supported by older versions that's why your IDE is complaining... Commented Oct 24, 2016 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.