How to use DPAD to navigate through action menu item on Android 5 -


i trying add dpad navigation support app. however, found not possible move focus action menu items on android 5. works fine on android 4.4.4, see attached screenshot below, robot icon focused , highlighted. enter image description here

same code not work on android 5.1.1 nexus7. have idea?

attached code , xmls.

mainactivity.java:

package com.example.zzztest;  import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem;  public class mainactivity extends actionbaractivity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);     }      @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate menu; adds items action bar if present.         getmenuinflater().inflate(r.menu.main, menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item) {         // handle action bar item clicks here. action bar         // automatically handle clicks on home/up button, long         // specify parent activity in androidmanifest.xml.         int id = item.getitemid();         if (id == r.id.action_settings) {             return true;         }         return super.onoptionsitemselected(item);     } } 

menu xml:

    <item         android:id="@+id/action_settings"         android:orderincategory="100"         android:title="@string/action_settings"         app:showasaction="never"/>      <item         android:id="@+id/action_asdf"         android:icon="@drawable/ic_launcher"         android:title="@string/action_settings"         app:showasaction="always"/> </menu> 

layout xml:

    <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/hello_world" />  </relativelayout> 

<item android:id="@+id/action_settings" android:orderincategory="100" android:title="@string/action_settings" app:showasaction="always"/> 

i used app:showasaction="always". press dpad "menu" button , can selected.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -