CardView bottom border is cut off inside ScrollView android -
i putting cardview inside scrollview, expect see @ bottom, border should shown(see pic below). not. problem cannot scroll bottom see border of cardview.
all solutions on change layout_margins paddings, not case cardview if want show border. tried everything. still doesnt work.
picture 1. scroll bottom cannot see border
picture 2. can see top border
following xml code
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <scrollview android:layout_width="match_parent" android:layout_height="wrap_content" android:fillviewport="true"> <android.support.v7.widget.cardview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="8dp"> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > ... </linearlayout> </cardview> </linearlayout>
references: scrollview doesn't scroll bottom
scrollview cuts off top , leaves space @ bottom
i ran same problem , had following (the key linearlayout wrapper around cardview added paddingbottom):
<scrollview android:id="@+id/item_scrollview" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="none" tools:visibility="visible"> <linearlayout android:id="@+id/item_wrapper_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="@dimen/content_margin" android:paddingbottom="32dp" android:orientation="vertical"> <android.support.v7.widget.cardview android:id="@+id/item_cardview" android:layout_width="match_parent" android:layout_height="wrap_content" card_view:cardbackgroundcolor="@color/colorprimary" card_view:cardcornerradius="4dp" card_view:cardusecompatpadding="true">
adding linearlayout wrapper around cardview worked me.
also note, had add card_view:cardusecompatpadding="true" on cardview border shadow looking correct.
here end result red box shows padding has been added when cardview expanded , scrolled up.
Comments
Post a Comment