0

我在 NestedScrollView 中有 recyclerview 和其他 cardview

这是完整的xml

<?xml version="1.0" encoding="utf-8"?><FrameLayout
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"
tools:ignore="MissingPrefix"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v4.widget.NestedScrollView
    android:id="@+id/scrollview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="@dimen/home_content_padding">

            <android.support.v7.widget.CardView
                android:id="@+id/card_desc"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:cardBackgroundColor="?attr/card_background"
                app:cardUseCompatPadding="true"
                app:cardElevation="@dimen/card_home_elevation"
                app:cardCornerRadius="@dimen/card_home_corner_radius"
                app:contentPadding="@dimen/card_home_content_padding">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:textColor="?android:attr/textColorPrimary"
                    android:textSize="14sp"
                    android:text="@string/home_description"
                    fontPath="fonts/Font-Regular.ttf"/>

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

            <android.support.v7.widget.RecyclerView
                android:id="@+id/home_grid"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:cardUseCompatPadding="true" />

            <android.support.v7.widget.CardView
                android:id="@+id/card_more_apps"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:cardBackgroundColor="?attr/card_background"
                app:cardUseCompatPadding="true"
                app:cardElevation="@dimen/card_home_elevation"
                app:cardCornerRadius="@dimen/card_home_corner_radius">

                <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:text="@string/home_more_apps_header"
                        android:textSize="16sp"
                        android:textColor="?android:attr/textColorPrimary"
                        android:padding="@dimen/home_content_padding"
                        fontPath="fonts/Font-Bold.ttf"/>

                    <View
                        android:layout_width="match_parent"
                        android:layout_height="1dp"
                        android:background="?attr/divider_list" />

                    <com.balysv.materialripple.MaterialRippleLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        app:mrl_rippleAlpha="0.15"
                        app:mrl_rippleColor="?attr/card_ripple"
                        app:mrl_rippleDelayClick="true"
                        app:mrl_rippleOverlay="true"
                        app:mrl_rippleDuration="500"
                        app:mrl_rippleDimension="4dp" >

                        <LinearLayout
                            android:id="@+id/more_apps"
                            android:orientation="horizontal"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:gravity="center_vertical"
                            android:padding="@dimen/home_content_padding">

                            <ImageView
                                android:id="@+id/more_apps_icon"
                                android:layout_width="40dp"
                                android:layout_height="40dp" />

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:text="@string/home_more_apps"
                                android:textSize="14sp"
                                android:layout_marginLeft="@dimen/home_content_padding"
                                android:layout_marginStart="@dimen/home_content_padding"
                                android:textColor="?android:attr/textColorSecondary"
                                fontPath="fonts/Font-Regular.ttf"/>

                        </LinearLayout>

                    </com.balysv.materialripple.MaterialRippleLayout>

                </LinearLayout>

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

        </LinearLayout>

</android.support.v4.widget.NestedScrollView>

<View
    android:id="@+id/shadow"
    android:layout_width="match_parent"
    android:layout_height="@dimen/toolbar_shadow"
    android:background="@drawable/toolbar_shadow" /></FrameLayout>

我面临的问题是应用程序首次启动时,第一个卡片视图隐藏在回收站视图后面。查看此视频以了解确切的问题问题视频

我尝试将父 LinearLayout 更改为 RelativeLayout,然后使用 layout_below 属性,但这没有用。知道可能是什么问题吗?另外,我是代码的初学者,所以如果我错过了一些愚蠢的事情,请放轻松。谢谢

4

1 回答 1

0

终于找到了解决方案,唯一需要做的就是将recyclerview设置为不可聚焦,如 RecyclerView.setFoucsable(false);

这是原始答案链接

于 2016-11-20T12:02:52.150 回答