【发布时间】:2018-03-18 22:07:23
【问题描述】:
所以我正在学习 Android 应用程序开发,但我有点卡住了。我正在尝试使用 CardViews 制作 RecyclerView,但 CardViews 之间的空间太大。 This is what it looks like.
我希望 Google 应用在提要中具有更多外观。 This is more like what I'm shooting for.
无论如何,我已经在这个网站上搜索并搜索了我的问题的解决方案,但似乎没有任何东西对我有用。我希望有人能给我一些真正有用的东西。
这是我的卡片视图的 xml:
<?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="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp">
<android.support.v7.widget.CardView
android:id="@+id/cv"
android:layout_width="match_parent"
android:layout_height="120dp"
app:cardCornerRadius="10dp"
app:cardElevation="5dp"
app:cardUseCompatPadding="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<TextView
android:id="@+id/note_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="false"
android:layout_below="@+id/event_time"
android:textSize="24sp" />
<TextView
android:id="@+id/note_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/note_title" />
</RelativeLayout>
</android.support.v7.widget.CardView>
【问题讨论】:
-
尝试减少这些:app:cardCornerRadius="10dp" app:cardElevation="5dp"
标签: android