ScrollView嵌套多個(gè)元素子view
<ScrollView
android:id="@+id/my_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/view_line"
android:scrollbarSize="3dp"
android:scrollbarThumbVertical="@drawable/shape_content_scrollbars_style"
android:layout_marginBottom="50dp"
android:overScrollMode="never">
<LinearLayout
android:id="@+id/ll_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<X5WebView
android:id="@+id/news_content"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginTop="@dimen/dp10"
android:layout_marginBottom="@dimen/dp5" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="@dimen/dp5"
android:layout_marginRight="10dp" />
<TextView
android:id="@+id/tv_created_at"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:paddingLeft="10dp"
android:text="時(shí)間"
android:textColor="@color/color_676767"
android:textSize="@dimen/sp12"
android:visibility="gone" />
</LinearLayout>
</ScrollView>
導(dǎo)致 RecyclerView item顯示不全,十條數(shù)據(jù)只顯示八條,滑動(dòng)也有一點(diǎn)點(diǎn)粘連的感覺不是太流暢。
兩張圖片對(duì)比

解決
1、
使用NestedScrollView替代ScrollView,解決顯示不全
<android.support.v4.widget.NestedScrollView
....
</android.support.v4.widget.NestedScrollView>
能顯示全部item 沒問題

2、
滑動(dòng)粘連不太流暢,ScrollView和RecyclerView都有滑動(dòng)事件,二者起了沖突,禁止掉RecyclerView滑動(dòng)事件。 代碼里面添加一句
Recycer.setNestedScrollingEnabled(false);
