android-cardview

BitmapDrawable cannot be cast to RoundRectDrawableWithShadow

孤者浪人 提交于 2019-12-21 06:00:35
问题 I am trying to extend a cardview to set the background image. I know that this can not be done with normal cardview. I have searched net and found plenty of solutions for setting a background color to the card view but none for image. My code to do so: public class CCView extends CardView { public CCView (Context context) { super(context); init(); } public CCView (Context context, AttributeSet attrs) { super(context, attrs); init(); } public CCView (Context context, AttributeSet attrs, int

Android CardView with a custom shadow color

回眸只為那壹抹淺笑 提交于 2019-12-21 03:17:18
问题 Is it possible to change the color of the shadow around the CardView? Mainly used to mark selected the card as it were lighted on ? Should be valid on L and pre-L devices. 回答1: CardView shadow colors are defined in the resources of the CardView library. You can override them by redefining the resource value in your own project but you can not change them dynamically by code. Edit: overriding the resource value only affects pre-Lollipop devices. On Lollipop and above, CardView always uses the

RecyclerView + CardView + Touch feedback

萝らか妹 提交于 2019-12-20 10:24:22
问题 Has anybody solved the mystery of the CardView without touch feedback when it's inside a RecyclerView ? I have a RecyclerView with a bunch of CardViews (a CardList ). When I click on any CardView, I start another Activity. That's working pretty fine, but I can't see any touch feedback when I click on the CardView. Just in time, I've already configured my CardView (XML) with these: android:clickable="true" android:background="?android:selectableItemBackground" Thanks! 回答1: Background: The

Why there is no space between CardViews on Lollipop?

僤鯓⒐⒋嵵緔 提交于 2019-12-20 08:13:33
问题 I try to use the CardView and it works well below 5.0, but looks strange on Lollipop. <?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="match_parent" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen

Why there is no space between CardViews on Lollipop?

☆樱花仙子☆ 提交于 2019-12-20 08:12:37
问题 I try to use the CardView and it works well below 5.0, but looks strange on Lollipop. <?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="match_parent" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen

android recyclerview: how do I programmatically select TextView background color?

三世轮回 提交于 2019-12-20 07:07:26
问题 I have a RecyclerView list of CardViews. On each CardView, the user previosuly selected the "type" from a dropdown dialog. The type choices are "Work" and "Home". The type choice is stored in an SQLite database as a String. When I run the app, no view is shown for the TextView "cardtype1" which is supposed to show the type choice from the database. How can I set a different background color for TextView type that is shown on the CardView, depending on what the user selects and is stored in

Autosearching option using filter method in recyclerview

╄→尐↘猪︶ㄣ 提交于 2019-12-20 04:30:48
问题 In my app I have implemented a recyclerview with cardview to show the list of the employee inside a company. Now I want to implement a serch option by which user can search with the name of the employee. I have read related document in website about it. I wrote a code to implement a serch option. But unfortunately I can see the search option and I can write it but it cannot detect the name from the list. I do not know what is the problem inside my code. Here is my adapter class where I

getAdapterPosition() not returning position of item in RecyclerView

和自甴很熟 提交于 2019-12-19 00:39:50
问题 This is a sort of follow-up or complement to this post. I am trying to get the position of an item in my RecyclerView, but none of the methods I have tried have worked. I called getAdapterPosition() in my PersonViewHolder constructor and assigned its value to the integer position, which is used in the UnitOneFragment class to do something accordingly (see onClick() method). But whatever that something is, it doesn't happen and my guess is because the getAdapterPosition() method doesn't work

Cardview corner background not transparent

白昼怎懂夜的黑 提交于 2019-12-18 12:26:42
问题 I have a custom implementation of a CardView support widget but I can't seem to get the background for the corners transparent when I include it in my layout-file. However, if I simply place the CardView support widget in my layout-file it suddenly works. How can I get the corners transparent for my custom component? This is the layout file for my custom implementation of the CardView: view_card.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http

Changing CardView shadow color

心已入冬 提交于 2019-12-18 10:35:23
问题 This question was asked on SO many times, but still I didn't find a good solution for this problem. Why do I need this to do? Well because project me and my team develops has iOS style. What did I try? 9.pathch shadow generator but 9.pathes are essentially pngs and it gives me no flexibility and if I'll use this approach I should edit margins everywhere. Carbon library it supports custom shadows and they get drawn outside of view borders, but there is issue regarding rounded rectangles, when