Questions tagged [cardview]

CardView is a widget for implementing 'card-styled' views in Android.

In Android, a card is a self-contained view similar to Android's FrameLayout (in fact CardView extends FrameLayout) which gives you the possibility of setting up an high contrast between the card and the background through elevation, thus generating more immersive apps.

CardView is often used in combination to RecyclerView. Usually, you would have multiple cards and use the RecyclerView as a container for scrolling between them.

You can read more about cards and recycler view here: https://developer.android.com/training/material/lists-cards.html

568 questions
2
votes
1 answer

How to change the border color of CardView by first clicking and again change back to previous color on Second click Android?

How to do it using selector instead of changing background? if(isSelected) { binding.cvStainMaster.setBcackgroundResource(R.drawable.boarder_blue_corner); …
T B
  • 191
  • 4
  • 22
2
votes
1 answer

cardview androdix dependency

I tried to implement cardview in android studio but after putting implementation 'androidx.cardview:cardview:1.0.0' under dependencies and syncing... This error occurred: Build file 'C:\Users\USER\AndroidStudioProjects\LearnALanguage\build.gradle'…
2
votes
2 answers

Change Raduis CardView Background Color

I have a CardView with radius and stroke, but when I change the CardView Background programmatically, the radius and stroke are lost, I want the new color to stay inside the stroke. This is my cardview…
Anas Hafidi
  • 349
  • 1
  • 5
  • 15
2
votes
1 answer

Recyclerview + CardView OnClickListener

I'm using Recyclerview for my datalist in CardView, but I don't know how to make onClick in my data list. Can someone help me to solve this? My code is: HomeFragment.Java public class HomeFragment extends Fragment { @Override public…
2
votes
2 answers

CardView error: Cannot resolve class android.support.v7.widget.CardView

I'm trying to use cardview with my recyclerview. The recycler view works on its own. I've got it set up with databinding. But I wanted the recyclerview to look better which is why I'm wanting to use cardview with it. This is my layout file for…
James Futures
  • 185
  • 2
  • 12
2
votes
2 answers

ERROR: Failed to resolve: cardview Affected Modules: app

I want to use CardView in my project but it shows ERROR: Failed to resolve: cardview Affected Modules: app,Why?I checked dependencies and updated android studio but again it shows same error dependencies { implementation fileTree(dir: 'libs',…
user11621919
2
votes
1 answer

Opening specific activity when clicking on a specific cardview

I have 5 cardviews that each has their data loaded from my Firebase project. I want each of them to open a specific activity but when i click a random one All 5 activities starts. So my question is: How do I open a specific Activity when clicking on…
DannyTraan
  • 145
  • 9
2
votes
1 answer

CardView elevation and border getting removed after animating CardView

I have a card view and I am animating it on a button click. When it is animated for the first time, card has shadow and elevation but when I animate again shadow and elevation is not there. I have tried multiple things. Nothing worked. I am not…
2
votes
2 answers

Could not get unknown property 'androidx' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler

I'm trying to build a location tracker app with the help of below YouTube Video. "https://www.youtube.com/watch?v=17HqLBkuX-E" In build.gradle module I have replaced the CardView and recyclerview lines instead for the lines in the video as they were…
Poo
  • 143
  • 4
  • 19
2
votes
1 answer

Android Studio: Component is selected but Attributes editor says "No component selected"

TL;DR: Although I can edit component attributes directly in XML (sanity check — I'm sane) the Attributes inspector pane claims nothing is selected. I.e. "It doesn't work." I added a CardView to the main layout. It does show up in the Component Tree…
Andrew Duncan
  • 3,553
  • 4
  • 28
  • 55
2
votes
1 answer

Button is not showing over cardView in android but working in iOS in react native

I am creating a button over a cardView , It is working in iOS -- But it is not working same in android , it is showing like--- My code is for creating this -
Deepti Raghav
  • 852
  • 1
  • 9
  • 26
2
votes
2 answers

How can i detect if a Card or a RecyclerView's item is selected?

i'm new to Android and i'm working on a University project, an app to take notes. I can add and delete note, but i would like to implement a classic way to delete an item: long press on it and delete it with dialogs or whatever. This is what i have:…
2
votes
1 answer

Scale CardView proportionally to screen resolution

I have an activity with three rectangle CardViews. I have set the size constraints such that they change according to the screen resolution. Please view my constraints here. The problem is that the CardViews are not changing their size…
ghDev
  • 170
  • 1
  • 12
2
votes
2 answers

Is Every ImageView Need CardView?

I am using imageView for upload profile image but i got a issue about it..
2
votes
2 answers

How to set CardViews from ArrayList in ListView

So I'm working with my android app that takes data from firebase, basically a list of cars that I save into an ArrayList of a specific class. I want to show a list of CardView with one car object each, in other words, that each card displays the…
Coexito
  • 53
  • 1
  • 9