我目前正在开发一个具有不同卡片的应用程序,这些卡片包含在NestedScollView
. 但如果我不把属性minHeight
放在CardView
什么都没有的appair上。
XML
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/tools"
card_view:cardPreventCornerOverlap="false"
card_view:cardUseCompatPadding="true"
card_view:cardElevation="8dp"
android:layout_margin="5dp"
android:layout_below="@+id/emptyView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:clipToPadding="false"
app:clipChildren="false">
<android.support.percent.PercentRelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.weezyu.utils.custom.widget.RalewayTextView
style="@style/WeezyuTheme.TextView"
android:id="@+id/activitiesTitle"
android:gravity="left|center_vertical"
android:text="Activities"
android:textColor="#88000000"
android:paddingLeft="20dp"
android:layout_height="0dp"
android:layout_width="0dp"
card_view:layout_widthPercent="100%"
card_view:layout_heightPercent="10%"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/activitiesList"
android:layout_below="@id/activitiesTitle"
android:layout_height="0dp"
android:layout_width="0dp"
card_view:layout_widthPercent="100%"
card_view:layout_heightPercent="80%"/>
<com.weezyu.utils.custom.widget.RalewayTextView
style="@style/WeezyuTheme.TextView"
android:id="@+id/activitiesAdd"
android:layout_below="@+id/activitiesList"
android:text="Show More"
android:textColor="#88000000"
android:clickable="true"
android:background="?android:attr/selectableItemBackground"
android:layout_height="0dp"
android:layout_width="0dp"
card_view:layout_widthPercent="100%"
card_view:layout_heightPercent="10%" />
</android.support.percent.PercentRelativeLayout>
</android.support.v7.widget.CardView>
编辑:不wrap_content
工作PercentRelativeLayout