android-cardview

What is the best practice to group items into CardView?

孤街醉人 提交于 2019-11-28 16:12:52
CardView usually used to decorate exactly one element. But sometimes you need to wrap into this widget several items. Like in Inbox app, for example. So what is the best way to do this? It can be implemented via custom LayoutManager or even custom ItemDecoration. Implementation of custom LayoutManager is not an easy task(with full support of animations, item decorations, etc). In the second option, the drawing of the boundaries must be implemented manually, ignoring CardView(and Android-L elevation) implementation. TL;DR: It's not one CardView which hosts elements, it's several successive

Strange behaviour of images in RecyclerView

谁都会走 提交于 2019-11-28 15:58:44
问题 I am using android.support.v7.widget.RecyclerView to show simple items containing text and in some cases also images. Basically I followed the tutorial from here https://developer.android.com/training/material/lists-cards.html and just changed the type of mDataset from String[] to JSONArray and the xml of the ViewHolder. My RecyclerView is located in a simple Fragment: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android

Setting Elevation in XML on AppCompat CardView on Android 5.0

 ̄綄美尐妖づ 提交于 2019-11-28 15:56:15
From what I understand, early in the preview stage there seemed to be no way to set elevation in XML only on CardView s without a hack in Java. Now that the official release is out, is there any way of doing this in XML without writing Java code to set elevation? I have tried card_view:cardElevation to no effect. I had thought when I was using the emulators for 5.0 everything was fine. But now that I'm using the official version on my actual device all of my CardView s disappeared Pre Lollipop, it works great. Here is my full xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7

How to show CardView containing ads randomly but not before 3 cards and not after 7 cards?

非 Y 不嫁゛ 提交于 2019-11-28 14:44:25
I'm following this tutorial to show cards and integrate Tinder-like swipe feature. In-between the cards I want to show ads and for that I'm using AdMob . Here's the code: @Layout(R.layout.ad_cards_view) public class AdCards { @View(R.id.adView) NativeExpressAdView nativeExpressAdView; private Context mContext; private SwipePlaceHolderView mSwipeView; public AdCards (Context context, SwipePlaceHolderView swipePlaceHolderView) { mContext = context; mSwipeView = swipePlaceHolderView; } @Resolve private void onResolved() { AdRequest request = new AdRequest.Builder() .addTestDevice("***")

Android: RecyclerView's CardView Not Showing Every Time

半城伤御伤魂 提交于 2019-11-28 12:34:19
问题 I have a RecyclerView in MainActivity that shows a list of CardViews and that is working properly. A click on the CardView finishes the RecyclerView Activity and launches a Detail Activity that shows the clicked on CardView in a new RecyclerView list. The Detail Activity is used only to show that single CardView in a RecyclerView (I do this so I can use RecyclerView's ItemTouchHelper.SimpleCallback code on the CardView for easy left swipe for the user). Here is the problem: I hit the left

Parent click event not firing when recyclerview clicked

这一生的挚爱 提交于 2019-11-28 12:00:02
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 xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="5dp" card_view

CardView shadow not appearing in Lollipop after obfuscate with proguard

不打扰是莪最后的温柔 提交于 2019-11-28 08:29:21
问题 My CardView's shadows have disappeared on Lollipop devices after applying Proguard. I haven't defined any rule to protect this library, because I haven't read it was necessary at all. I attach you a couple of screenshots, first without running proguard, and secon after running it. Screenshot without proguard Screenshot with proguard And this is my xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http:

RecyclerView: how to catch the onClick on an ImageView?

强颜欢笑 提交于 2019-11-28 07:59:20
问题 I have an ImageView in CardViews of my RecyclerView. I would like to catch the onClick on the ImageView, like I already did with the ListView. So, in the public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) I tried with: myViewHolder.imageView.setClickable(true); myViewHolder.imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.d("TEST", "Clicked"); } but this was totally ignored. The following code is working:

How to add swipe functionality on Android CardView?

你离开我真会死。 提交于 2019-11-28 05:34:35
I have a single CardView that contains two TextViews and two ImageViews. I want to be able to swipe left and right to "dismiss". I actually want swipe right to send an Intent but that can be done later. For now, I want to be able to dismiss the CardView by swiping left or right. I also want the animation of swiping. I tried using romannurik's SwipeDismissTouchListener but the CardView does not respond to swiping. If anyone has a better solution than romannurik's custom listener, please share. Here's my CardView layout: <android.support.v7.widget.CardView android:layout_width="match_parent"

Touch feedback with RecyclerView and CardView

一笑奈何 提交于 2019-11-28 02:54:57
I would love to enable touch feedback for my Open-Source library. I've created a RecyclerView and a CardView . The CardView contains different areas with different onClick actions. Now I would love to trigger the Ripple effect if a user clicks anywhere in the card, but I'm not able to achieve this behavior. This is my listitem, You can find it on GitHub too: https://github.com/mikepenz/AboutLibraries/blob/master/library/src/main/res/layout/listitem_opensource.xml <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:clickable="true" android:background