android-cardview

How to add colored border on cardview?

a 夏天 提交于 2019-11-30 01:33:59
I am new to Android and this is my first question here. I am trying to add a colored vertical border at the beginning of the cardview. How can I achieve it on xml ? I tried adding it with empty textview but it is messing up the whole cardview itself. Please check the picture link posted below for example. Colored Border on Cardview activity_main.xml <android.support.v7.widget.CardView android:layout_width="fill_parent" android:layout_height="wrap_content" card_view:contentPadding="16dp" card_view:cardElevation="2dp" card_view:cardCornerRadius="5dp"> <LinearLayout android:layout_width="fill

Changing CardView shadow color

痴心易碎 提交于 2019-11-30 01:02:27
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 library doesn't draw shadow for rounded corners. using old CardView implementation and overriding its

Add clickListner for button inside a cardView populated using a recyclerView

自闭症网瘾萝莉.ら 提交于 2019-11-30 00:39:12
I have a cardView card_contents.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="150dp" android:layout_marginTop="10dp" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:id="@+id/card_view"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffa3a4a6"> <TextView android:layout

How do I expand CardViews to show more detail like Google Keep cards?

六眼飞鱼酱① 提交于 2019-11-30 00:00:21
I have some CardViews in my app and I want them to function like the cards in Google Keep. For example, when I click on a card that has text, it expands (with the animation) into another view. If you're not sure what I mean, create a note on the Google Keep Android app, tap on the card that appears when the note is created. This is exactly what I want to happen in my app. How do I go about doing this? New in Lollipop! Activity + Fragment Transitions By declaring "shared elements" that are common across two screens you can create a smooth transition between the two states. album_grid.xml:

How to set the padding for CardView widget in Android L

江枫思渺然 提交于 2019-11-29 23:28:57
I'm using android:paddingLeft and android:paddingTop to set the padding for the new CardView widget but it doesn't work. I can set the margin for all the controls inside the CardView as a workaround but that's a pain if there are too many controls. How to set padding for the new cardview widget? <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_gravity="center" android:layout_width="match_parent" android:layout_height="200dp" android:paddingLeft="20dp" android:paddingRight="@dimen/activity_horizontal_margin"

Expand and collapse CardView

自闭症网瘾萝莉.ら 提交于 2019-11-29 20:19:19
What is the proper way to expand a CardView? Use an expandable list view with cardview or even You can use wrap content as height of cardview and use textview inside it below title, so on click make the textview visible and vice-versa . but isn't it bad design ? nope it isn't if you give some transition or animation when it's expanded or collapsed If you want to see some default transition then just write android:animateLayoutChanges="true" in parent layout . Heisenberg If you are using CardViews inside a ListView or RecyclerView see my answer for recommended way of doing it: RecyclerView

Strange behaviour of images in RecyclerView

白昼怎懂夜的黑 提交于 2019-11-29 20:09:59
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:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android

Copy to clipboard the content of a cardview

时光总嘲笑我的痴心妄想 提交于 2019-11-29 18:16:58
I've implemented a recycler card view and want to use a button click method to copy the content of cardView. There aretwo texts in cardview and i want to copy the content only, different for different cards. How can I do this? Here is my Cardview adapter. public static class ViewHolder extends RecyclerView.ViewHolder{ Button copyButton; Button shareButton; TextView title; TextView content; public ViewHolder(View itemView) { super(itemView); this.title = (TextView)itemView.findViewById(R.id.card_title); this.content = (TextView)itemView.findViewById(R.id.card_content); this.copyButton= (Button

Android: RecyclerView's CardView Not Showing Every Time

牧云@^-^@ 提交于 2019-11-29 17:28:33
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 caret on the Detail Activity's Toolbar to return to the MainActivity. Then a click on the exact same

CardView elevation not working on Android 5.1.1

て烟熏妆下的殇ゞ 提交于 2019-11-29 15:46:00
问题 I am using CardView inside a RecyclerView. After reading a lot I ended up with following 'NOT WORKING' code only on Android 5.1.1. On Android Version prior to this one its working nice. <?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:layout_width="match_parent" android:layout_height="match_parent" android:background="#11ffffff" android:orientation="vertical"