android - Options menu items not working when Scroll view is used -


i created xml file menu , inflating in oncreateoptionsmenu() method.

the menu items working fine in lollipop device nested scrollview, not working (they visible not able click on items) in previous versions.

when remove scrollview working fine. when gave padding of ?attr/colorprimary or more scrollview not working. there problem nestedscrollview or scrollview action bar? need scroll view. doing wrong?

activity layout file:

<android.support.design.widget.appbarlayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:theme="@style/apptheme.appbaroverlay">      <android.support.v7.widget.toolbar         android:id="@+id/toolbar"         android:layout_width="match_parent"         android:layout_height="?attr/actionbarsize"         android:background="?attr/colorprimary"         app:popuptheme="@style/apptheme.popupoverlay" />  </android.support.design.widget.appbarlayout>  <android.support.v4.widget.nestedscrollview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:paddingtop="?attr/actionbarsize">      <include layout="@layout/content_display_list" />  </android.support.v4.widget.nestedscrollview>  <com.google.android.gms.ads.adview     android:id="@+id/adview"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_centerhorizontal="true"     android:layout_gravity="bottom"     ads:adsize="banner"     ads:adunitid="@string/banner_ad_unit_id"> </com.google.android.gms.ads.adview>  <android.support.design.widget.floatingactionbutton     android:id="@+id/fab"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_gravity="bottom|start"     android:layout_marginbottom="55dp"     android:layout_marginleft="@dimen/fab_margin"     android:src="@android:drawable/ic_input_add"     android:tint="#ffffff"     app:backgroundtint="#86e384" />  </android.support.design.widget.coordinatorlayout> 

menu xml file:

<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.manisankarj.todolist.displaylist">     <item         android:id="@+id/action_settings"         android:title="@string/action_settings"         app:showasaction="ifroom" />     <item         android:id="@+id/menu_displaylist_past"         android:title="past items"         android:icon="@android:drawable/ic_lock_idle_alarm"         app:showasaction="always" /> </menu> 

activity file:

protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_display_list);     toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar);     setsupportactionbar(toolbar); } public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.menu_display_list, menu);     return true; } 

i figured out. wrapped entire nestedscrollview in framelayout , options menu items responding in pre-lollipop devices.

<framelayout     android:layout_width="match_parent"     android:layout_height="match_parent"     app:layout_behavior="@string/appbar_scrolling_view_behavior">      <android.support.v4.widget.nestedscrollview         android:layout_width="match_parent"         android:layout_height="match_parent">          <include layout="@layout/content_display_list" />      </android.support.v4.widget.nestedscrollview>  </framelayout> 

but still not understand why behaved in such way on pre-lollipop devices. may bug actionbar.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -