I am using Recycler view + card view to show my content but there is unnecessary space between cards how to remove it.
I have tried with negative padding but didnt work. Any other solution to this? or there is any bug in my code.
my RecyclerView
<android.support.v7.widget.RecyclerView
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:id="#+id/reyclerview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/darker_gray"
android:scrollbars="vertical" />
cardview
<?xml version="1.0" encoding="utf-8"?><android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
app:cardCornerRadius="4dp"
card_view:cardElevation="0dp"
card_view:cardUseCompatPadding="true"
card_view:cardPreventCornerOverlap="false"
android:background="#color/background">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:layout_marginStart="4dp">
//Some Items
</RelativeLayout>
here is the preview of space
xml :
card_view:cardPreventCornerOverlap="false"
or JAVA
cardView.setPreventCornerOverlap(false)
ref : Android CardView remove padding
I have solved it by putting cardview in LinearLayout
<?xml version="1.0" encoding="utf-8"?><LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:layout_marginStart="4dp">
<ImageView
android:id="#+id/i1"
android:layout_width="50dp"
android:layout_height="50dp" />
<TextView
android:id="#+id/t1"
android:layout_width="316dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="60dp"
android:text="Text1"
android:textSize="15sp" />
<TextView
android:id="#+id/t2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/t1"
android:maxLines="2"
android:layout_alignStart="#+id/t1"
android:layout_marginStart="8dp"
android:layout_marginTop="10dp"
android:text="Text2"
android:textSize="12sp" />
</RelativeLayout>
</android.support.v7.widget.CardView>
Related
Hello, I tried to copy the Code of a tutorial, but it doesn't work out for me... The Layout_below won't move the text to underneath the picture, can somebody help?
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
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"
android:padding="20dp"
android:id="#+id/parent"
app:cardCornerRadius="7dp"
app:cardElevation="7dp"
android:layout_margin="5dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ImageView
android:layout_width="130dp"
android:layout_height="150dp"
android:id="#+id/imgFood"
android:src="#mipmap/ic_launcher"
android:contentDescription="#string/todo" />
<TextView
android:id="#+id/txtMealName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/imgFood"
android:layout_centerHorizontal="true"
android:layout_marginTop="7dp"
android:text="#string/meal_name"
android:textSize="16sp"
android:textStyle="bold" />
</com.google.android.material.card.MaterialCardView>
your text view and image view are not inside RelativeLayout
replace below code with your code
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
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"
android:padding="20dp"
android:id="#+id/parent"
app:cardCornerRadius="7dp"
app:cardElevation="7dp"
android:layout_margin="5dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="130dp"
android:layout_height="150dp"
android:id="#+id/imgFood"
android:src="#mipmap/ic_launcher"
android:contentDescription="some text" />
<TextView
android:id="#+id/txtMealName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/imgFood"
android:layout_centerHorizontal="true"
android:layout_marginTop="7dp"
android:text="cheese pizza "
android:textSize="16sp"
android:textStyle="bold" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
close Relative layout using </RelativeLayout> after Textview
I have problem with CardView background opacity. I want to make my background semi transparent, but I have a weir bug that happens all the time. The best explanation will be a screenshot from my program.
Scr from displayed layout
I want this Layout to be all in the same semi transparent color. Instead what appears is this semi transparent color with more transparent rectangle inside. I don't know how to remove this rectangle from my layout. Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="15dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
app:cardBackgroundColor="#66000000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="15dp">
<ImageView
android:id="#+id/flagImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:fontFamily="#font/changa_light"
android:scaleType="fitXY"
app:srcCompat="#mipmap/ic_launcher" />
</androidx.cardview.widget.CardView>
<TextView
android:id="#+id/flagTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TEST"
android:textColor="#ffffff"
android:gravity="center"
android:fontFamily="#font/changa_light"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</RelativeLayout>
SOLVED! I had to add app:cardElevation="0dp to the first CardView
Is this what you want?
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="312dp"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="4dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="#color/sisman2"
app:cardCornerRadius="20dp"
app:cardElevation="2dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:ellipsize="end"
android:gravity="center"
android:singleLine="true"
android:text="HELLO"
android:textSize="24sp" />
</RelativeLayout>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="248dp"
android:elevation="0dp"
app:cardCornerRadius="20dp"
app:cardElevation="0dp">
</androidx.cardview.widget.CardView>
</RelativeLayout>
</androidx.cardview.widget.CardView>
enclose the first cardView object in a frame layout, then give it elevation and keep it at the top (remember! elevation> = API 21)
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/transparentColor"
android:elevation="3dp"
android:stateListAnimator="#null">
<!-- into-->
</FrameLayout>
I have a RecyclerView that programmatically inflates CardViews. The left side of the card is getting cut off and they are not centered. If you need any more code posted, I would be happy to do so.
Here is some helpful code:
Activity:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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_height="match_parent"
android:layout_width="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context=".Activity.ClassRoster"
tools:showIn="#layout/activity_class_roster"
android:orientation="vertical"
android:gravity="center">
<android.support.v7.widget.RecyclerView android:id="#+id/roster_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingTop="16dp"
android:clipToPadding="false"
android:scrollbars="vertical"
android:gravity="center"/>
</LinearLayout>
Cards being inflated:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/student_card_linlayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/student_card"
android:layout_width="#dimen/student_card_width"
android:layout_height="#dimen/student_card_height"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
card_view:cardUseCompatPadding="true"
card_view:cardPreventCornerOverlap="false"
android:clickable="true"
android:foreground="#drawable/custom_bg"
card_view:cardCornerRadius="#dimen/student_card_radius"
card_view:cardElevation="#dimen/student_card_elevation">
<RelativeLayout android:id="#+id/card_layout"
android:background="#color/a"
android:layout_width="match_parent"
android:layout_height="160dp">
<TextView android:id="#+id/student_name"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:textColor="#android:color/white"
android:text="TS"
android:textSize="#dimen/student_card_text_size"
android:gravity="center"
android:textIsSelectable="false"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
<android.support.v7.widget.Toolbar android:id="#+id/card_toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_gravity="bottom">
<ImageView android:id="#+id/student_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="25dp"
android:layout_marginEnd="5dp"
android:src="#drawable/ic_delete_black_24dp"/>
<ImageView android:id="#+id/student_absent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:layout_marginBottom="25dp"
android:src="#drawable/ic_change_history_black_24dp"/>
</android.support.v7.widget.Toolbar>
</android.support.v7.widget.CardView>
</LinearLayout>
To make your text center, change TextView width to match_parent
<RelativeLayout android:id="#+id/card_layout"
>
<TextView android:id="#+id/student_name"
android:layout_width="match_parent" // before it is wrap_content
... />
</RelativeLayout>
Make your bottom center correct
// I organize the flow of your layout from left-to-right
// Before it is right-to-left
<android.support.v7.widget.Toolbar android:id="#+id/card_toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_gravity="bottom">
<ImageView android:id="#+id/student_absent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:layout_marginBottom="25dp"
android:src="#drawable/ic_change_history_black_24dp"/>
<ImageView android:id="#+id/student_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="25dp"
android:src="#drawable/ic_delete_black_24dp"/>
</android.support.v7.widget.Toolbar>
Hope this help
Try to remove the top-level LinearLayout of your item xml like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/student_card"
android:layout_width="#dimen/student_card_width"
android:layout_height="#dimen/student_card_height"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
card_view:cardUseCompatPadding="true"
card_view:cardPreventCornerOverlap="false"
android:clickable="true"
android:foreground="#drawable/custom_bg"
card_view:cardCornerRadius="#dimen/student_card_radius"
card_view:cardElevation="#dimen/student_card_elevation">
<RelativeLayout android:id="#+id/card_layout"
android:background="#color/a"
android:layout_width="match_parent"
android:layout_height="160dp">
<TextView android:id="#+id/student_name"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:textColor="#android:color/white"
android:text="TS"
android:textSize="#dimen/student_card_text_size"
android:gravity="center"
android:textIsSelectable="false"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
<android.support.v7.widget.Toolbar android:id="#+id/card_toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_gravity="bottom">
<ImageView android:id="#+id/student_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="25dp"
android:layout_marginEnd="5dp"
android:src="#drawable/ic_delete_black_24dp"/>
<ImageView android:id="#+id/student_absent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:layout_marginBottom="25dp"
android:src="#drawable/ic_change_history_black_24dp"/>
</android.support.v7.widget.Toolbar>
</android.support.v7.widget.CardView>
Folks,
I am out of options while attempting to removing extra space between cardview items in my recyclerview below is the current output. Please suggest.
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#303030"
android:id="#+id/cv"
android:layout_marginTop="2dip"
android:layout_marginBottom="2dip"
card_view:cardUseCompatPadding="true"
card_view:cardElevation="5dp"
android:foreground="?android:attr/selectableItemBackground"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:padding="5dp"
android:longClickable="true"
android:background="#303030">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/person_photo"
android:background="#drawable/vector_red"
android:layout_alignBottom="#+id/txtSub" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="#+id/txtMain"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/person_photo"
android:layout_toEndOf="#+id/person_photo"
android:elevation="4dp"
android:textSize="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/txtSub"
android:layout_below="#+id/txtMain"
android:layout_toRightOf="#+id/person_photo"
android:layout_toEndOf="#+id/person_photo" />
</RelativeLayout>
</android.support.v7.widget.CardView>
My Recycler view
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeFragment">
<android.support.v7.widget.RecyclerView
android:id="#+id/rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
card_view:cardUseCompatPadding="false"
card_view:cardPreventCornerOverlap="false"
android:background="#0fffffff" />
</RelativeLayout>
I have not implemented a RecyclerView, however I have replicated two rows in a linear layout, minus the padding from your original question:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:background="#303030"
android:id="#+id/cv1"
card_view:cardElevation="5dp"
android:foreground="?android:attr/selectableItemBackground"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_margin="4dp"
android:longClickable="true"
android:background="#303030">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/person_photo"
android:background="#drawable/vector_red"
android:layout_alignBottom="#+id/txtSub" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="#+id/txtMain"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/person_photo"
android:layout_toEndOf="#+id/person_photo"
android:elevation="4dp"
android:textSize="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/txtSub"
android:layout_below="#+id/txtMain"
android:layout_toRightOf="#+id/person_photo"
android:layout_toEndOf="#+id/person_photo" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:background="#303030"
android:id="#+id/cv1"
card_view:cardElevation="5dp"
android:foreground="?android:attr/selectableItemBackground"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_margin="4dp"
android:longClickable="true"
android:background="#303030">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/person_photo"
android:background="#drawable/vector_red"
android:layout_alignBottom="#+id/txtSub" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="#+id/txtMain"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/person_photo"
android:layout_toEndOf="#+id/person_photo"
android:elevation="4dp"
android:textSize="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/txtSub"
android:layout_below="#+id/txtMain"
android:layout_toRightOf="#+id/person_photo"
android:layout_toEndOf="#+id/person_photo" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
Play around with the padding and you will get better results. You can also try adding a background color to your card, then you can get rid of layout margins in your RelativeLayout!
All you need to do is remove the following two lines from the xml for the CardLayout:
android:layout_marginTop="2dip"
android:layout_marginBottom="2dip"
What this does is sets the seperation between the two layouts, in this case you have 4dip (2 at the top and 2 at the bottom). You can also try to reduce it to 1 dip and verify the effect it gives you.
Hope this helps :)
Can you please try this one ?
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
...
...
...
</android.support.v7.widget.CardView>
I have checked, it works fine for me.
Check screenshot:
Hope this will help you.
change your card layout to
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#303030"
android:id="#+id/cv"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="2dp"
card_view:cardPreventCornerOverlap="false"
card_view:cardUseCompatPadding="true">
In the card view xml change in the overall parent layout width to wrap content.
android:layout_width="match_parent"
to
android:layout_width="wrap_content"
My problem is that when i try to change the radius of the cardView i get this in the Image below:
any help would be appreciated.
These words just to skip the error your post is mostly code:
skipping stupid error.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<android.support.v7.widget.CardView
android:id="#+id/cv"
android:background="#color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="10dp">
<!--android:padding="16dp"-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/team_photo"
android:layout_width="70dp"
android:layout_height="70dp"
android:padding="10dp"
android:layout_margin="8dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/team1Linear"
android:orientation="horizontal">
<TextView
android:id="#+id/team1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ssss"
android:textColor="#color/black"
android:textSize="15sp" />
<TextView
android:id="#+id/team1_score"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:text="ssss"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:textColor="#color/black"
android:textSize="15sp" />
</LinearLayout>
<View
android:id="#+id/separator"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/background_material_light" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/team2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ssss"
android:textColor="#color/black"
android:textSize="15sp" />
<TextView
android:id="#+id/team2_score"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:text="ssss"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:textColor="#color/black"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
you need to use
app:cardUseCompatPadding="true"
this will do that job for you
Those are shadows of CardViews. It's normal, there is no problem.
So CardViews have their elevations that they drop shadows on the background.
You set radius for the CardViews. Then you can look the background through rounded corners. You see the shadows of CardViews dropping on the background.
app:cardCornerRadius="10dp"
If you don't want the rounded corners of the CardViews, I think you should just set the radius to 0.
app:cardCornerRadius="0"
add this, your problem with the shadow
app:cardElevation="#dimen/dp_0"