CardView bottom border is disabled inside ScrollView android

I put the cartography inside the scrollview, we expect to see that the border should be shown at the bottom below (see the figure below). But he is not. The problem is that I cannot scroll to the bottom to see the border of the map.

All solutions on SO are changing layout_margins to paddings, but this is not the case for cardview if we want to show the border. I basically tried everything. But still does not work. scroll down to not see the border

Image 1. Scroll down to see the border.

we can see the upper bound

Figure 2. We can see the upper bound

Below is the 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> 

links: ScrollView does not scroll down

ScrollView disables the top and leaves space at the bottom

I can not show LinearLayout below to view the scroll

Android ScrollView refuses to scroll to the end

+8
android scrollview cardview
source share
2 answers

One solution I just found is to wrap CardView with LinearLayout or RelativeLayout and install its add-on. For example, if you want to get the shadow effect in cardView, say 8dp, you can install the 4dp complement of your LinearLayout or RelativeLayout and 4dp layout_margin CardView.

+4
source share

I ran into the same problem and had to do the following (the key is the LinearLayout wrapper around the map where I 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 the LinearLayout wrapper around the map is what worked for me.

Also note: I had to add card_view: cardUseCompatPadding = "true" on the map to get the correct shadow border.

Here is the final result, in which the red box shows where the addition is supplemented when expanding and scrolling the map.

screenshot

+9
source share

All Articles