FAQ Database Discussion Community


Programmatically “swipe-to-dismiss” an item in a ListView/RecyclerView?

android,listview,swipe,recyclerview,android-cardview
I need to be able to programmatically dismiss an item inside a RecyclerView without the user actually swiping (instead I want to dismiss the item when they tap a button in the card). A lot of libraries I've seen only seem to support actual swipes. I've tried using an existing...

Clicking CardView to load a fragment

android,android-fragments,recyclerview,android-cardview
I'm having trouble with implementing clickable cards with my RecyclerView. I want to get the position of which card was clicked and then load the proper fragment. I did take a look at this post and spent almost 30 minutes trying to make sense of the code and implementing it...

What is the accurate way to customize cards with cardslib?

android,android-layout,android-cardview,cardslib
I have a card declared in the file cardslib_item_card_view: <it.gmariotti.cardslib.library.view.CardViewNative xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/apk/res-auto" card_view:cardCornerRadius="4dp" style="@style/native_recyclerview_card.base" android:id="@+id/carddemo" android:layout_width="match_parent" android:layout_height="wrap_content"> and set as content view within onCreate() method: public...

RecyclerView with Scrollable CardView

android,scrollview,recyclerview,android-cardview
What I'd like to do I've got a RecyclerView with different CardView's inside. For that I wrote a RecycleView.Adapter with a RecyclerView.ViewHolder. Which works perfectly fine. Now I'd like to have cards which host a ScrollView. My Layout for that looks like following: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp">...

Cardslib's CardView OnCardClickListener's onClick method not being called

android,android-layout,recyclerview,android-cardview,cardslib
I am using this library in my app: Card Library : Guide and created a card as shown in the example. Now I need to handle a click event, but I receive an error when instantiating the following: new Card.OnCardClickListener, which says OnCardClickListener is abstract: cannot be instantiated. In my...

Cards dont show visual feedback

android,onclicklistener,android-cardview
I have a recycler adapter full of cards. The cards themselves work fine. However when i click the card it does not show any visual feedback its being clicked. Is there something im missing? I also would appreciate a tutorial on mateial design animation. The android developer site didnt really...

Advantage and disadvantage of CardView

android,performance,android-layout,android-widget,android-cardview
What are the advantages and drawbacks of CardView, other than the shadow or elevation, what is the benefit in performance and looks? What is done using CardView can also be done using a combination of other layouts.

Error when inflating CardView

java,android,android-5.0-lollipop,android-support-library,android-cardview
I am using a RecyclerView to hold a list of CardViews. On my device running Lollipop 5.0.2, the app runs fine and the list displays the data correctly. however, on other pre-lollipop devices such as one running 4.4.2, I get the following error: android.view.InflateException: Binary XML file line #2: Error...

Limit width of CardView

android,xml,android-cardview
Is there a simple way of limiting the width of a CardView widget? On very large screens I want to keep space blank on either sides of the cards instead of stretching the card to make it extremely wide.

CardsLib listview not getting populated

android,android-cardview,cardslib
I am using Cardslib and am trying to populate each card with an custom layout. I have everything set up but I cannot seem to get this to work. The problem I am having is that the CardListView doesn't get populated. Here's my codes: public class ThemeActivity extends Activity {...

Android button on card view, get position of card view on click

android,android-listview,android-cardview,recycler-adapter
I've got a card-view that each card has a button on it. I'm trying to get the position of the card that holds the button when the users clicks the button. I have an adapter that extends from RecyclerView.Adapter and implements the following method... public void onBindViewHolder(MovieImageViewHolder movieImageViewHolder, int i)...

CardView Click state not working [closed]

android,material-design,android-cardview
I would like to change the color of Card Item whenever user does tap on any of the item, but nothing happens.. why ? <android.support.v7.widget.CardView android:layout_width="fill_parent" android:layout_height="wrap_content" card_view:cardCornerRadius="3dp" android:layout_marginTop="9dp" android:layout_marginLeft="9dp" android:layout_marginRight="9dp" card_view:cardElevation="0.01dp" android:layout_marginBottom="0dp" android:foreground="@drawable/card_foreground"> ...

Initialize correct class from button in CardView

java,android,android-layout,android-activity,android-cardview
EDIT: Found my answer in this post: http://stackoverflow.com/a/28304164/2911440 I'm trying to initialize functions from a button inside a CardView. <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="24sp" <Button android:id="@+id/btnStart" style="?android:attr/borderlessButtonStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="startFunctionClick" android:text="START" /> But in my attempt to find an...

How to fix unexpected white line in bottom of CardView in Android

android,android-layout,android-support-library,android-cardview
I have a CardView like this, but there is a white line at the bottom where there shouldn't be. Any idea what could be causing this? Here is the code! <android.support.v7.widget.CardView android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="5" app:cardCornerRadius="4dp" android:layout_margin="5dp"> <ListView android:id="@+id/home_list_listview" android:layout_width="match_parent" android:layout_height="match_parent" android:divider="@null" android:dividerHeight="0dp"...

Can one use cardview for listview item and how

android,android-cardview
I would like to implement cardview in my app so that all listview items be cardviews. Is it simple as encapsulating listview item xml in cardview?

Cardview with dividers in it

android,android-studio,android-5.0-lollipop,android-cardview
I've seen those CardViews (I'm not sure they're even CardViews) with dividers used in a lot of apps, so I'm guessing there is an easy way to create them. I wanted to ask how is it exactly done? are those even CardViews? I couldn't find out more about them because...

Update text within card view list?

android,android-fragments,recyclerview,android-cardview,recycler-adapter
So I have a recyclerview list of card views.I am trying to update the text time text in each view when the user clicks the card, and then reset it back when time has past. I set up an internal method in recyclerviewadapter but when I call updateTimes (calling from...

Design UI Android (Element between CardViews)

android,android-layout,android-cardview
My question is more informative. I just want to know how to make such design. I found android application called "weather timeline" and inside of that application between CardViews (as I understand) they used this element which I pointed out in picture below. I think its just ImageView but how...

Android Material CardView with full screen image on Cardview

android,material-design,android-cardview
i need to do this : http://developer.android.com/design/material/images/card_travel.png so i create and add the dependency to the project and here is my activity main code: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/feed_detail" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.CardView android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_margin="6dp">...

No adapter attached; skipping layout

android,android-adapter,recyclerview,android-cardview
logcat error : No adapter attached; skipping layout I changed the context argument with getActivity(), but the app is still not running. public class FragmentActivity extends Fragment { private RecyclerView mRecyclerView; private CountryAdapter mAdapter; private LinearLayoutManager layoutManager; public FragmentActivity(){} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View...

Data on cardview are changed while srolling RecyclerView

android,recyclerview,android-cardview
I am newbie to Android apps development. I have a class, which contains RecyclerView. public class ScreenOne extends Fragment implements SwipeRefreshLayout.OnRefreshListener { private RecyclerView mRecyclerView; private FilmSetAdapter mAdapter; private RecyclerView.LayoutManager mLayoutManager; SwipeRefreshLayout mSwipeRefreshLayout; RequestTask requestTask; ArrayList<Film> listOfFilms; ArrayList<Cinema> listOfCinemas; ArrayList<String> cityIDs; public ScreenOne() { } @Override public View onCreateView(LayoutInflater...

Android CardView And Eclipse ADT

android,android-support-library,eclipse-adt,android-cardview
Im using Eclipse and have a trouble with cardview. error: No resource identifier found for attribute 'cardCornerRadius' in package I already add latest android-support-v7-cardview.jar to libs folder and build path. My CardView layout: <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"...

Android app stops working after moving to using creating the layout with java

java,android,xml,android-cardview
I am making an app that predicts the winner of a soccer game. I am new to android programming and all recyclerview tutorials are a little confusing, but I need to put all my information from each user prediction into a cardview, so I transfered all my xml code into...

Create RelativeView inside CardView programmatically android studio

java,android,android-relativelayout,android-cardview
I am trying to create a history activity page for my app. I get data from an sql table with the users data, and set that to a card. I have created the first card in my History activity, and I do not want to pre-create all the cards, but...

material support library, can't find Cardview/Recycleview

android,eclipse,android-5.0-lollipop,material-design,android-cardview
I have searched the internet but i couldn't find my answer. How can I use Card view/Recycle view they are not in my layout palette or i can't use them manually and I am using eclipse

RoundCorner Image inside CardView

android,xml,android-cardview
I using CardView from support library I have a RoundCorner Image inside that But radius not apply to Image is it Bug with Cardview or Problem with my XML ? ( I used this RoundCorner Image library many times and works fine ) I test this on nexus 5 android...

RecyclerView adapter is showing blank cardview

android,android-support-library,recyclerview,android-cardview,recycler-adapter
I have a nasty issue on sub api21 devices. I am using a RecyclerView.Adapter adapter to inflate android.support.v7.widget.CardView. The idea is that the cards will only add information that is present to the cards. If no information is present the card wont show at all. So I create these cards...

NullPointerException on getResources() for a CardView

java,android,nullpointerexception,android-cardview
I have a problem that bugs me a lot... I need to call a string array in a normal java class in an Android project, but for the love of God I can't figure out how to getResources() over here... I tried some getContext ideas from Google but to no...

How to display image and text from Cardview in another activity onClick?

android,onclicklistener,android-cardview,android-viewholder,android-recyclerview
I have a sample app from exoguru which contains cardview each card consists of an image and corresponding text .Now how to display that image and text in another activity on clicking that particular card? Here is the screenshot Here is the ViewHolder which contains the onclick for the cardview...

OnClick event on TextView stops RippleEffect on CardView

android,android-layout,android-5.0-lollipop,android-cardview
I have a TextView inside a CardView. When enabling the ripple effect for Lollipop on the CardView by adding a OnClick event and adding the property: android:foreground="?android:attr/selectableItemBackground" It works fine. But after adding a OnClick event to the TextView, the ripple effect still shows up when I click outside of...

Cardslib's CardRecyclerView is always null

android,android-layout,recyclerview,android-cardview,cardslib
I am developing with cardslib library and implementing this example. Although I slavishly follow the instructions in the tutorial when I create a CardRecyclerView object, that object appears to always be null. Check my code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.native_recyclerview_card_layout); ArrayList<Card> cards = new ArrayList<Card>(); //Create a...

How create several columns of CardViews

java,android,xml,android-cardview
I try create fragment with several columns of the CardViews: <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="3dp" android:orientation="horizontal" > <android.support.v7.widget.CardView android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" app:cardElevation="2dp" app:cardCornerRadius="3dp"> <TextView android:text = "column 1" android:layout_width = "wrap_content" android:layout_height = "wrap_content" />...

Convert RecyclerView items to CardView on click

android,android-layout,android-cardview,android-recyclerview
I want to change my RecyclerView items to a CardView with a few buttons(that I'll do by myself). I don't understand how to convert it to a cardview on click. Here's my code: MainActivity.java public class MainActivity extends AppCompatActivity { RecyclerView recyclerView; RVAdapter rvAdapter; @Override protected void onCreate(Bundle savedInstanceState) {...

Card view scale animation

android,android-cardview
In my app i have a cardview which contains a text view and a button and the button is initially hidden and when the card view is clicked the button is shown. I don't know how to animate it into view when the button is shown. Can anyone suggest a...

ListView elements beside each other [closed]

android,listview,android-cardview
I would like create an application with a list of podcast with an UI like Google Music, but I do not know how to place items horizontally beside the other podcasts rather than below. I use a listView and a cardView. ...

How to keep the status of the ViewHolder in RecyclerView

android,android-cardview,android-recyclerview
I have a RecyclerView which includes a few grid cells. There is a TextView above CLICK ME button. I'll show something for example, the name at the TextView when button is clicked. The problem for me is the text inside the TextView is not persistent. Here is my code in...

RecyclerView With CardView

android,android-cardview,android-recyclerview
I am using RecyclerView + CardView to list all the countries from A-Z like I have here But I want them to line up next to each other so save space like this What is the best way to achieve this? CardAdapter public class CardAdapter extends RecyclerView.Adapter<CardAdapter.ViewHolder> { List<Nationality> mItems;...

Parent click event not firing when recyclerview clicked

android,android-cardview,android-recyclerview
I have a RecyclerView which is in a CardView that has a couple of TextViews. The CardView has a OnClickListener set and is fired off when clicking on the TextViews, but does not fire when clicking on the RecyclerView. Here is what the CardView looks like: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView...

CardView and RecyclerView divider behaviour

android,android-layout,android-listview,android-cardview,android-recyclerview
I am trying to use RecyclerView with CardView as an single item of the list. I want to implement horizontal list, with LayoutManager it is really easy. So I started to implement it. It seems that everything works, but not as I expected here is the result using CardView as...

Transparent background on CardView - Android

android,background,android-cardview
I want to do transparent background on CardView. I know backgroundColor but i have image on my Layout. Do you know how do it? Or something which work as cardview but i will set a transparent background? Regards...

Android - How to create a view like this using recycler view?

android,android-textview,recyclerview,android-cardview,roundedbitmapdrawable
Can anyone help me with this custom layout inside a card view? I am showing a list of items and need to show an item like this. But cant understand how to implement this. Basically, There is a recycler view Inside it, there are cards. The card has a...

Cardslib round corners

android,android-layout,android-cardview,cardslib
I have two projects where I create a set of custom cards extending the card class, and then I insert them into a StaggeredView. My problem is that in one of these projects the cards corners are automatically rounded, while on the other one not! Moreover in the second project...

Google Play Store Cardview

java,android,material-design,android-cardview
I have been trying for a long time to make Cards similar to appearance that of Google Play Store, ie cards of Different sizes , with images and all inside the card. Any tips on how to proceed.

How to customize cardview?

android,customization,android-cardview
how can i customize cardview in such a way (the top left one)? In my way, if i add 3 corored boxes (blue, gray, white) i always get a thin border on the perimeter of the cardview box. Any example? Thanks. ...

Custom Drawable not generating round corners for CardView's image

android-layout,android-imageview,android-cardview,cardslib
I created a list of Cards with the new CardView and RecyclerView that look this way: I've tried to modify the card with round corners as explained by Mariotti in this post. PROBLEM: The problem is that, as you can see from the screenshot I am only able to set...

CardView corners not rounded in an AlertDialog

android,android-layout,rounded-corners,android-cardview
I'm creating an AlertDialog and the custom layout for that dialog is a CardView (the card is the root of the xml layout): <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/moreInfoCard" android:layout_gravity="center" app:cardCornerRadius="12dp" android:layout_width="wrap_content" android:layout_height="wrap_content"> //my layout content...

Missing resources for Android CardView library

android,appcompat,android-cardview
I'm using CardView in my project and I'm getting an error on older devices: E android.view.InflateException: Binary XML file line #25: Error inflating class android.support.v7.widget.CardView E at android.view.LayoutInflater.createView(LayoutInflater.java:518) E at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570) E at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) E at android.view.LayoutInflater.rInflate(LayoutInflater.java:626) E at android.view.LayoutInflater.inflate(LayoutInflater.java:408) E at...

Set onClickListener on the RelativeLayout contained by CardView

android,android-layout,recyclerview,android-cardview
I am trying to set the onClickListener on each of my CardView elements. Since I was not able to set the onClickListener on the cards themselves (see here), I thought about setting it to the RelativeLayout contained by the cards. Right now I am using the native CardView library and...

Sliding Tabs With RecyclerView Showing Blank

android,android-fragments,android-cardview,android-recyclerview
I am using Sliding tabs with RecyclerView to show text and images and I think I have it setup correctly but for some reason it is just showing blank in each tab can someone please tell me what is wrong? This is how it should look But it's just showing...

How to change text based on time and date?

android,android-layout,text,countdown,android-cardview
So I need one of two options but don't know where to start with either. I have a list card views in a recyclerview. Each card view needs to have countdown timer implemented and able to run simultaneously. (Seems like the harder option) OR Update the text in a card...

CardView disappearing on API 19

android,android-layout,android-studio,android-cardview
I have developed an app that works perfectly on Lollipop. However, I am experiencing some strange glitches on kitkat (api 19) When I run my app on the kitkat device, it shows my card view for a split second then it disappears. below is my xml layout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"...

Android: how can I insert a RecyclerView inside CardView?

android,recyclerview,android-cardview,android-viewholder,recycler-adapter
The activity I am talking about must show a RecyclerView populated by CardViews as items. My goal is to show in every CardView a RecyclerView in its turn. Here my Activity's basic xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".ConjActivity" > <android.support.v7.widget.RecyclerView android:id="@+id/conjCardList"...

Android: OnClickListener of Button on CardView

onclicklistener,android-context,android-cardview,android-recyclerview
I'm a bit of a newbie so I apologize if this is an easy question. I'm following this tutorial: http://www.truiton.com/2015/03/android-cardview-example/#comment-7174 It shows how to make a few CardViews in a layout with 2 TextViews in each - all programmatically. I would like to modify it to have a Button instead...

RecyclerView onBindViewHolder onclicklistener behavior

android,recyclerview,android-cardview,android-viewholder
I am trying to load a recycler view that lists cards, each card has four elements. two text views(posttext, score are the id) and two buttons(minusOne and plusOne). The code below loads the textview's content and buttons properly on all cards. I try to implement the following behavior. onbuttonclick of...