这就是我想要的东西
请帮我解决我的问题。
RecyclerView
无法正常工作。另外,我想补充一点,我首先TextView
点击RecyclerView
。我做错了什么?或者帮我构建一个布局。 <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:background="@color/white"
tools:context="com.bottlemessage.btlmsg.view.module.game.wallet.WalletActivity">
<ImageView
android:id="@+id/wallet_activity_back_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="12dp"
android:padding="4dp"
android:src="@drawable/selector_background_back_btn"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.bottlemessage.btlmsg.view.util.view.TextTypeface
android:id="@+id/wallet_activity_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:text="@string/wallet_activity_title"
android:textColor="@color/blue"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="@+id/wallet_activity_back_btn"
app:layout_constraintStart_toEndOf="@+id/wallet_activity_back_btn"
app:layout_constraintTop_toTopOf="@+id/wallet_activity_back_btn"
app:typeface="textbook_bold"
tools:text="Discounts" />
<FrameLayout
android:id="@+id/wallet_activity_separator"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginEnd="3dp"
android:layout_marginStart="3dp"
android:layout_marginTop="10dp"
android:background="#E9EBF0"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wallet_activity_title" />
<FrameLayout
android:id="@+id/wallet_activity_main_container"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wallet_activity_separator">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:elevation="0dp">
<include
android:id="@+id/toolbar"
layout="@layout/wallet_activity_toolbar" />
<FrameLayout
android:id="@+id/wallet_activity_separator2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginEnd="3dp"
android:layout_marginStart="3dp"
android:background="#E9EBF0"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wallet_activity_title" />
</android.support.design.widget.AppBarLayout>
<com.chauthai.overscroll.RecyclerViewBouncy
android:id="@+id/wallet_activity_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<FrameLayout
android:id="@+id/wallet_activity_item_copy_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="12dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="12dp"
android:background="@drawable/background_rectangle_item_expand_in_wallet"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
<LinearLayout
android:id="@+id/wallet_activity_item_empty_list_block"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:visibility="visible"
app:layout_constraintTop_toBottomOf="@+id/toolbar">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:src="@drawable/ic_empty_discount_list" />
<com.bottlemessage.btlmsg.view.util.view.TextTypeface
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="@string/discount_activity_no_discounts_yet"
android:textAlignment="center"
android:textSize="24sp" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/wallet_activity_whoops_block"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:visibility="gone" />
</android.support.constraint.ConstraintLayout>
添加项目而RecyclerView的高度为0.项目仅在点击空白区域时显示这是布局
User.includes(:todos).where(todos: { created_at: 1.day.ago.to_date})