【发布时间】:2019-06-20 00:09:32
【问题描述】:
我有带有 cardview 根布局的水平 recyclerview,它有巨大的填充
cardview 应该在 textview 的末尾结束
这里是 XML 文件:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:cardBackgroundColor="@android:color/darker_gray">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/main_category_name"
android:id="@+id/mainCategoryName"
android:layout_centerInParent="true"
android:textColor="@android:color/black"
android:textSize="16sp"
android:textStyle="bold"/>
</android.support.v7.widget.CardView>
这是第二个文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ShoppingPackage.MainShoppingActivity">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/mainCategoriesRecyclerView"
android:background="@android:color/white"
android:clipToPadding="false"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/mainCategoriesRecyclerView"
android:id="@+id/subCategoriesRecyclerView"
android:clipToPadding="false"/>
</RelativeLayout>
【问题讨论】:
标签: android android-recyclerview padding