Android ListView未在NestedScrollView中滚动(片段)
我无法在NestedScrollView(片段)中的listView中滚动 尝试的代码:Android ListView未在NestedScrollView中滚动(片段),android,xml,android-layout,listview,android-xml,Android,Xml,Android Layout,Listview,Android Xml,我无法在NestedScrollView(片段)中的listView中滚动 尝试的代码: setNestedScrollingEnabled(true); <android.support.v4.widget.NestedScrollView android:fillViewport="true" /> and <View android:nestedScrollingEnabled = "true" /> setNestedScrollingEnabled(true
setNestedScrollingEnabled(true);
<android.support.v4.widget.NestedScrollView android:fillViewport="true" /> and <View android:nestedScrollingEnabled = "true" />
setNestedScrollingEnabled(true);
及
我知道我不应该在NestedScrollView中使用ListView,但我现在没有其他选择
希望有人能帮忙 从使用RecyclerView开始,自2014年以来,没有人使用ListView。另外,您能否使布局文件更简洁,只保留与问题相关的内容。@Nicolas我下次会,对于RecyclerView,我还需要更改所有java代码?@Nicolas它与许多java代码链接使用RecyclerView启动,自2014年以来没有人使用ListView。另外,你能使布局文件更简洁,只保留与问题相关的内容吗?@Nicolas我下一次会,对于RecyclerView,我还需要更改所有java代码?@Nicolas它与许多java代码链接
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="50px">
<WebView
android:id="@+id/wb"
android:layout_width="match_parent"
android:layout_height="244dp"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto_bold"
android:text="Recherche statistique des pays "
android:textColor="#5E5E5E"
android:textSize="24dp" />
<View
android:layout_width="40dp"
android:layout_height="6dp"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:background="@drawable/bg_view">
</View>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto_regular"
android:text="ÉVOLUTION DU CORONAVIRUS COVID-19 "
android:textColor="#5E5E5E"
android:textSize="18dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<SearchView
android:id="@+id/cher"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:orientation="horizontal">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="@font/roboto_medium"
android:text="Statistiques"
android:textColor="#5E5E5E"
android:textSize="18dp" />
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:background="#7a8b8b8b"></View>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<ProgressBar
android:id="@+id/loadin"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_weight="250" />
<ListView
android:id="@+id/ListC"
android:layout_width="match_parent"
android:layout_height="500dp"
android:layout_gravity="center"
android:divider="#ffffff"></ListView>
</LinearLayout>
<LinearLayout
android:id="@+id/lst1"
android:layout_width="match_parent"
android:layout_height="446dp"
android:layout_marginTop="14dp"
android:orientation="horizontal"/>
<LinearLayout
android:id="@+id/lin1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="horizontal"
android:visibility="gone">
<android.support.v7.widget.CardView
android:layout_width="160dp"
android:layout_height="120dp"
android:layout_weight="1"
app:cardCornerRadius="8dp"
app:cardElevation="2dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto_bold"
android:text="Nombre total de cas"
android:textColor="#5E5E5E"
android:textSize="18dp" />
<TextView
android:id="@+id/tot1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:textColor="#FFFFFF"
android:textSize="29dp" />
<ProgressBar
android:id="@+id/l1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:indeterminate="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="160dp"
android:layout_height="120dp"
android:layout_marginLeft="18dp"
android:layout_weight="1"
app:cardCornerRadius="8dp"
app:cardElevation="2dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto_bold"
android:text="Nouveaux cas"
android:textColor="#5E5E5E"
android:textSize="18dp" />
<TextView
android:id="@+id/casN1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:textColor="#FFFFFF"
android:textSize="29dp" />
<ProgressBar
android:id="@+id/l2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:indeterminate="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
<LinearLayout
android:id="@+id/lin2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal"
android:visibility="gone">
<android.support.v7.widget.CardView
android:layout_width="160dp"
android:layout_height="120dp"
android:layout_weight="1"
app:cardCornerRadius="8dp"
app:cardElevation="2dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto_bold"
android:text="Total des décès"
android:textColor="#5E5E5E"
android:textSize="18dp" />
<TextView
android:id="@+id/dead1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:textColor="#FFFFFF"
android:textSize="29dp" />
<ProgressBar
android:id="@+id/l3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:indeterminate="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="160dp"
android:layout_height="120dp"
android:layout_marginLeft="18dp"
android:layout_weight="1"
app:cardCornerRadius="8dp"
app:cardElevation="2dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto_bold"
android:text="Nouvelles morts"
android:textColor="#5E5E5E"
android:textSize="18dp" />
<TextView
android:id="@+id/Ndead1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:textColor="#FFFFFF"
android:textSize="29dp" />
<ProgressBar
android:id="@+id/l4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:indeterminate="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
<LinearLayout
android:id="@+id/lin3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:orientation="horizontal"
android:visibility="gone">
<android.support.v7.widget.CardView
android:layout_width="160dp"
android:layout_height="120dp"
android:layout_weight="1"
app:cardCornerRadius="8dp"
app:cardElevation="2dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto_bold"
android:text="Total récupéré"
android:textColor="#5E5E5E"
android:textSize="18dp" />
<TextView
android:id="@+id/Totrec1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:textColor="#FFFFFF"
android:textSize="29dp" />
<ProgressBar
android:id="@+id/l5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:indeterminate="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="160dp"
android:layout_height="120dp"
android:layout_marginLeft="18dp"
android:layout_weight="1"
app:cardCornerRadius="8dp"
app:cardElevation="2dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto_bold"
android:text="Cas active"
android:textColor="#5E5E5E"
android:textSize="18dp" />
<TextView
android:id="@+id/act1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:textColor="#FFFFFF"
android:textSize="29dp" />
<ProgressBar
android:id="@+id/l6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:indeterminate="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
<LinearLayout
android:id="@+id/lin4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:orientation="horizontal"
android:visibility="gone">
<android.support.v7.widget.CardView
android:layout_width="160dp"
android:layout_height="120dp"
android:layout_weight="1"
app:cardCornerRadius="8dp"
app:cardElevation="2dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto_bold"
android:text="Cas critique"
android:textColor="#5E5E5E"
android:textSize="18dp" />
<TextView
android:id="@+id/cri1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:textColor="#FFFFFF"
android:textSize="29dp" />
<ProgressBar
android:id="@+id/l7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:indeterminate="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="160dp"
android:layout_height="120dp"
android:layout_marginLeft="18dp"
android:layout_weight="1"
app:cardCornerRadius="8dp"
app:cardElevation="2dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto_bold"
android:text="Nombre total de cas / 1M habitants"
android:textColor="#5E5E5E"
android:textSize="18dp" />
<TextView
android:id="@+id/tot1m1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:textColor="#FFFFFF"
android:textSize="29dp" />
<ProgressBar
android:id="@+id/l8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:indeterminate="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>