滚动cardview不起作用 [英] scrolling cardview is not working

查看:94
本文介绍了滚动cardview不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是android应用程序开发的新手.我在android-studio中制作一个项目.我想列出将滑动的cardview.如果有人知道答案,请也分享您的答案和xml代码.我的xml代码在下面

I am new in android app development. I am making a project in android-studio. I want to list of cardview that will slide. If anyone knows the answer,please share your answer and xml code too.My xml code is below

<?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"
android:orientation="vertical"
android:background="@drawable/images"
tools:context="litifer.awesome.game.cardview.MainActivity"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/cardView1"
    android:layout_gravity="center"
    android:layout_marginTop="20dp"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    app:cardCornerRadius="5dp"
    app:cardElevation="5dp"
    android:clickable="true"
    >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/cardView1Text"
        android:text="Get in Touch"
        android:textSize="20dp"
        android:paddingTop="40dp"
        />
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/cardView1Edit"
        android:hint="Enter Email here"
        />
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/cardView1Button"
        android:text="Submit"
        android:layout_gravity="center" />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="40dp"/>
    </LinearLayout>
</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:id="@+id/cardView2"
    android:layout_gravity="center"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    app:cardCornerRadius="5dp"
    app:cardElevation="5dp"
    android:clickable="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/cardView2Text"
            android:text="Bluetooth demo"
            android:textSize="20dp"
            android:paddingTop="20dp"/>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/cardView1Text1"
            android:text="Send Notification when in Bluetooth range"
            android:textSize="20dp"
            android:clickable="true"
            android:paddingBottom="40dp"/>
    </LinearLayout>
</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:id="@+id/cardView3"
    android:layout_gravity="center"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    app:cardCornerRadius="5dp"
    app:cardElevation="5dp"
    android:clickable="true"
    android:paddingTop="40dp"
    android:paddingBottom="40dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/cardView3Text"
            android:text="Wifi Demo"
            android:textSize="20dp"
            android:paddingTop="40dp"/>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/cardView3Text1"
            android:text="Send Notification when in Wifi range"
            android:textSize="20dp"
            android:paddingBottom="40dp"/>
    </LinearLayout>
</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/cardView4"
    android:layout_marginTop="10dp"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    app:cardCornerRadius="5dp"
    app:cardElevation="5dp"
    android:layout_gravity="center"
    android:clickable="true"
    android:paddingTop="40dp"
    android:paddingBottom="40dp"
    >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/cardView4Text"
            android:text="Review Demo"
            android:textSize="20dp"
            android:paddingTop="40dp"/>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/cardView4Text1"
            android:text="Get Customer Reviews using beacons"
            android:textSize="20dp"
            android:paddingBottom="40dp"/>
    </LinearLayout>

</android.support.v7.widget.CardView></LinearLayout>

推荐答案

查找解决方案

<ScrollView 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"
android:fillViewReport="true">

<LinearLayout 
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/images"
tools:context="litifer.awesome.game.cardview.MainActivity">
//-----------
//-----------

</LinearLayout>

</ScrollView>

这篇关于滚动cardview不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆