android - Nested Scrollview does not work -


hi have material design gridview contains 29 items. in nested scroll view shows 10 of them when toolbar , not scroll, follows: enter image description here

another issue when click on items nothing happens, unless click somewhere on empty spot. xml :

    <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:id="@+id/android_coordinator_layout"     android:layout_width="match_parent"     android:layout_height="match_parent">      <android.support.design.widget.appbarlayout         android:layout_width="match_parent"         android:id="@+id/appbar_layout"         android:layout_height="@dimen/app_bar_height"         android:theme="@style/themeoverlay.appcompat.dark.actionbar">          <android.support.design.widget.collapsingtoolbarlayout             android:id="@+id/collapsing_toolbar_android_layout"             android:layout_width="match_parent"             android:layout_height="match_parent"             app:contentscrim="?attr/colorprimary"             app:expandedtitlemarginstart="@dimen/expanded_toolbar_title_margin_start"             app:layout_scrollflags="scroll|exituntilcollapsed">              <imageview                 android:id="@+id/image_view"                 android:layout_width="match_parent"                 android:layout_height="match_parent"                 android:scaletype="centerinside"                 android:src="@drawable/quizmat"                 app:layout_collapsemode="parallax"                 app:layout_collapseparallaxmultiplier="0.7" />              <android.support.v7.widget.toolbar                 android:id="@+id/toolbar"                 android:layout_width="match_parent"                 android:layout_height="?attr/actionbarsize"                 app:layout_collapsemode="pin"                 app:popuptheme="@style/themeoverlay.appcompat.light"                 app:theme="@style/themeoverlay.appcompat.dark.actionbar" />          </android.support.design.widget.collapsingtoolbarlayout>      </android.support.design.widget.appbarlayout>      <android.support.v4.widget.nestedscrollview         android:layout_width="match_parent"         android:id="@+id/nestedscrollview"         android:layout_height="match_parent"         android:fillviewport="true"         app:layout_behavior="@string/appbar_scrolling_view_behavior">          <linearlayout             android:id="@+id/linearlayout"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:orientation="vertical">              <gridview                 android:id="@+id/grid"                 android:layout_width="wrap_content"                 android:layout_height="match_parent"                 android:columnwidth="100dp"                 android:gravity="center"                 android:listselector="#00000000"                 android:numcolumns="auto_fit"                 android:stretchmode="columnwidth" />         </linearlayout>     </android.support.v4.widget.nestedscrollview>  </android.support.design.widget.coordinatorlayout> 

my java code:

import android.content.context; import android.content.intent; import android.os.bundle; import android.support.design.widget.collapsingtoolbarlayout; import android.support.design.widget.coordinatorlayout; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.view; import android.widget.adapterview; import android.widget.gridview;  import java.util.arraylist;  public class mainactivity extends appcompatactivity {      toolbar toolbar;     collapsingtoolbarlayout collapsingtoolbarlayoutandroid;     coordinatorlayout rootlayoutandroid;     gridview gridview;     context context;     arraylist arraylist;      public static string[] gridviewstrings = {             "آزمون 1",             "آزمون 2",            ...        };     public static int[] gridviewimages = {             r.drawable.i1,             r.drawable.i2,             ...     };      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          toolbar = (toolbar) findviewbyid(r.id.toolbar);         setsupportactionbar(toolbar);         gridview = (gridview) findviewbyid(r.id.grid);         gridview.setadapter(new customandroidgridviewadapter(this, gridviewstrings, gridviewimages));          initinstances();             gridview.setonitemclicklistener(new adapterview.onitemclicklistener() {             @override             public void onitemclick(adapterview<?> parent, view view, int position, long id) {                 if (position ==  0) {                     try                     {                         intent k = new intent(mainactivity.this, quizactivity.class);                         startactivity(k);                     }catch(exception e){                      }                 }                 if (position ==  1) {                     try                     {                         intent k = new intent(mainactivity.this, quizactivity2.class);                         startactivity(k);                     }catch(exception e){                      }                 }                 ....                 /////////////////.........             }         });     }      private void initinstances() {         rootlayoutandroid = (coordinatorlayout) findviewbyid(r.id.android_coordinator_layout);         collapsingtoolbarlayoutandroid = (collapsingtoolbarlayout) findviewbyid(r.id.collapsing_toolbar_android_layout);         collapsingtoolbarlayoutandroid.settitle("material grid");     }  } 

update

i resolved this. needed create recycleview gridlayoutmanager in fragment , remove nested scroll , replace fragment instead.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -