List view not scrolling in fragment using view pager inside NestedScrollView
<p>Hi there i needed to create layout like whatsapp, which scrolls the actionbar but not tabLayout. I used viewpager for loads fragment in it.
In fragment i added listview but on Listview scroll that action bar not scrolling there.
Using some tutorials on stackoverflow i got that for this purpose needed to use nestedScrollView and it works for me.
But it stops scrolling listview.
I used this code for that.</p>

<h1>activity_my.xml</h1>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;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/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"&gt;

&lt;android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;

    &lt;android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"&gt;&lt;/android.support.design.widget.CollapsingToolbarLayout&gt;

&lt;/android.support.design.widget.AppBarLayout&gt;

&lt;FrameLayout
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:layout_gravity="bottom"
    app:layout_anchor="@+id/appbar"
    app:layout_anchorGravity="bottom"
    app:layout_collapseMode="none"&gt;

    &lt;ImageView
        android:id="@+id/tabBg"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/primary"
        android:scaleType="fitXY" /&gt;

    &lt;android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:layout_gravity="bottom"
        android:background="#00000000"
        app:layout_anchor="@+id/appbar"
        app:layout_anchorGravity="bottom"
        app:layout_collapseMode="none"
        app:tabGravity="fill"
        app:tabIndicatorColor="#fff"
        app:tabIndicatorHeight="2dp"
        app:tabMode="scrollable"
        app:tabSelectedTextColor="#fff"
        app:tabTextColor="#fff" /&gt;

&lt;/FrameLayout&gt;
&lt;android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="?attr/actionBarSize"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt;

    &lt;LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="1000dp"
        android:orientation="vertical"&gt;

        &lt;android.support.v4.view.ViewPager
            android:id="@+id/pager"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"/&gt;
    &lt;/LinearLayout&gt;
&lt;/android.support.v4.widget.NestedScrollView&gt;

&lt;!--&lt;android.support.v4.view.ViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="?attr/actionBarSize"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" /&gt;--&gt;
&lt;/android.support.design.widget.CoordinatorLayout&gt;
</code></pre>

<h1>MyActivity.java</h1>

<pre><code>public class MyActivity extends AppCompatActivity {
private TabLayout tabLayout;
private ViewPager viewPager;
ArrayList&lt;Fragment&gt; fragmentArrayList;
TabAdapter tabAdapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);
    /*Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(false);*/

    viewPager = (ViewPager) findViewById(R.id.pager);
    setupViewPager(viewPager);

    tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);
}

private void setupViewPager(ViewPager viewPager) {
    TabAdapter adapter = new TabAdapter(getSupportFragmentManager());
    adapter.addFragment(new OneFragment(), "ONE");
    adapter.addFragment(new OneFragment(), "TWO");
    adapter.addFragment(new OneFragment(), "THREE");
    viewPager.setAdapter(adapter);
   }

 }
</code></pre>

<h1>FragmentOne.java</h1>

<pre><code>public class OneFragment extends Fragment {
ListView listTest;
ArrayList&lt;String&gt; itemList;
ArrayAdapter&lt;String&gt; adapter;

public OneFragment() {
    // Required empty public constructor
}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_one, container, false);
    listTest = (ListView) view.findViewById(R.id.listTest);
    itemList = new ArrayList&lt;&gt;();
    for (int i = 0; i &lt; 50; i++) {
        itemList.add("Item : " + i);
    }
    adapter = new ArrayAdapter&lt;String&gt;(getActivity(), android.R.layout.simple_list_item_1, itemList);
    listTest.setAdapter(adapter);
    return view;
   }
}
</code></pre>

<h1>fragment_one.xml</h1>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;
    &lt;ListView
        android:id="@+id/listTest"
        android:layout_width="match_parent"
        android:layout_height="match_parent"&gt;&lt;/ListView&gt;
&lt;/RelativeLayout&gt;
</code></pre>

<blockquote>
  <p>I used LinearLayout monHeight = 1000dp because if i use android:fillViewPort="true" in nestedScrollView and remove minHeight from LinearLayout then listview shows but not scroll.
  Now it scrolls but till 1000dp then the other items are not shown.</p>
</blockquote>