小编Rah*_*ala的帖子

CardView不滚动

下面是我的代码我有多个cardview内部LinearLayout但在构建后我无法滚动它.卡片视图的一半是隐藏的.

有一个屏幕截图

图片

我想滚动我的所有cardview.我试图添加,scrollview但它无法正常工作.添加后scrollview全部cardview不起作用

这是添加后发生的事情scrollview.

IAMGE2

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="eras.ppt.ras.MainActivity"
    android:orientation="vertical"
    android:padding="10dp"
    android:background="@drawable/backgroundimage"
    android:gravity="center"
    android:id="@+id/ll">

    <android.support.v4.view.ViewPager
        android:id="@+id/viewPager"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:layout_marginTop="10dp"
        android:layout_marginBottom="20dp"
        android:background="@color/transblue"/>

    <LinearLayout
        android:id="@+id/SliderDots"
        android:layout_below="@+id/viewPager"
        android:orientation="horizontal"
        android:gravity="center_vertical|center_horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    </LinearLayout>


    <LinearLayout
        android:clipToPadding="false"
        android:gravity="center"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <android.support.v7.widget.CardView
            android:foreground="?android:attr/selectableItemBackground"
            android:clickable="true"
            android:id="@+id/physics"
            android:layout_width="160dp"
            android:layout_height="190dp"
            android:layout_margin="10dp">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:gravity="center">
                <ImageView
                    android:layout_width="64dp"
                    android:layout_height="64dp"
                    android:background="@drawable/cerclebackgroundpurple"
                    android:src="@drawable/sigma"
                    android:padding="10dp"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textStyle="bold"
                    android:layout_marginTop="10dp"
                    android:text="Physics"/>
                <View
                    android:layout_width="match_parent" …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-scrollview cardview

5
推荐指数
1
解决办法
2856
查看次数