我想知道api并非所有api(min 16)因为ScrollView中的RecyclerView不能平滑滚动。我搜索Google,stackover等。我找到了很多解决方案,但都没有在我的手机上工作。我尝试使用
android:nestedScrollingEnabled="false"
android.support.v4.widget.NestedScrollView
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorGray">
<include
android:id="@+id/toolbar"
layout="@layout/tool_bar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/ll_bottom"
android:layout_below="@+id/toolbar">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<Button
android:id="@+id/btn_nearby_places"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_click"
android:drawableLeft="@drawable/ic_location_search"
android:gravity="left|center"
android:paddingLeft="20dp"
android:text="Nearby Places"
android:textColor="@color/colorWhite"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Here are 8 ways"
android:textColor="@color/colorGrayDark"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view_ways"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/txt_type_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Breakfast"
android:textColor="@color/colorGrayDark"
android:textSize="16sp"
android:textStyle="bold" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view_type_1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:layout_width="match_parent"
android:layout_height="0.6dp"
android:background="@color/colorGrayDark" />
<TextView
android:id="@+id/see_more_type_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:padding="5dp"
android:text="See More"
android:textColor="@color/colorGrayDark"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/txt_type_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Lunch"
android:textColor="@color/colorGrayDark"
android:textSize="16sp"
android:textStyle="bold" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view_type_2"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:layout_width="match_parent"
android:layout_height="0.6dp"
android:background="@color/colorGrayDark" />
<TextView
android:id="@+id/see_more_type_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:padding="5dp"
android:text="See More"
android:textColor="@color/colorGrayDark"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/txt_type_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Dinner"
android:textColor="@color/colorGrayDark"
android:textSize="16sp"
android:textStyle="bold" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view_type_3"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<View
android:layout_width="match_parent"
android:layout_height="0.6dp"
android:background="@color/colorGrayDark" />
<TextView
android:id="@+id/see_more_type_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:padding="5dp"
android:text="See More"
android:textColor="@color/colorGrayDark"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
所有这些都不能在我的手机上工作(5.1.1)。我的项目是min(16)
这是我的xml
recycler_view_ways = (RecyclerView) findViewById(R.id.recycler_view_ways);
recycler_view_type_1 = (RecyclerView) findViewById(R.id.recycler_view_type_1);
recycler_view_type_2 = (RecyclerView) findViewById(R.id.recycler_view_type_2);
recycler_view_type_3 = (RecyclerView) findViewById(R.id.recycler_view_type_3);
recycler_view_ways.setLayoutManager(new GridLayoutManager(this, 2));
recycler_view_type_1.setLayoutManager(new GridLayoutManager(this, 3));
recycler_view_type_2.setLayoutManager(new GridLayoutManager(this, 3));
recycler_view_type_3.setLayoutManager(new GridLayoutManager(this, 3));
recycler_view_ways.setAdapter(new WaysRVAdapter(MainActivity.this, waysList));
....
这是活动
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { SettingsPage } from './settings';
@NgModule({
declarations: [SettingsPage],
imports: [IonicPageModule.forChild(SettingsPage)],
})
export class SettingsPageModule { }