android-cardview

Different corner radius values for a MaterialCardView

£可爱£侵袭症+ 提交于 2021-02-18 22:27:08
问题 Is is possible to have different values for each corner radius of a MaterialCardView? And if so how? I tried something like the code below but it doesn't seem to have any effect float radius = getContext().getResources().getDimension(R.dimen.default_corner_radius); ShapePathModel leftShapePathModel = new ShapePathModel(); leftShapePathModel.setTopLeftCorner(new RoundedCornerTreatment(radius)); leftShapePathModel.setTopRightCorner(new RoundedCornerTreatment(radius)); MaterialShapeDrawable bg =

White Space with CardView on pre-lollipop devices

穿精又带淫゛_ 提交于 2021-02-16 12:59:37
问题 I am attempting to add rounding and shadows to some views on an app and am utilizing the card view library to achieve that. It is looking good on lollipop devices but am running into compatibility issues with anything pre-lollipop. I will preface this by saying that I have looked at the answers in the questions below have found that none of them are working for me. Appcompat CardView and Picasso no rounded Corners Cardview - white border around card Unnecessary padding in CardView? The most

How to Change CardView background color from a theme

泄露秘密 提交于 2021-02-10 20:27:06
问题 In an app that has multiple themes, how would you change the background color of the CardView from the styles file? styles.xml <style name="AppTheme1" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorPrimary">@color/colorPrimaryTheme1</item> <item name="colorPrimaryDark">@color/colorPrimaryDarkTheme1</item> <item name="colorAccent">@color/colorAccentTheme1</item> </style> <style name="AppTheme2" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorPrimary">@color

What is the best way to do sliding images in cardview inside recycler?

假装没事ソ 提交于 2021-02-07 11:55:14
问题 I have a RecyclerView with Cardview s. I want sliding images inside this CardView, just like in OLX app. What is the best way to do so? I think about puting viewpager inside cardview. Is it ok or maybe I should try something else? I did it with ViewPager but it looks like too slow. Here is a part of viewpager adapter. @Override public Object instantiateItem(ViewGroup collection, int position) { LayoutInflater inflater = LayoutInflater.from(mContext); ViewGroup layout = (ViewGroup) inflater

Swipe card to favourite item

こ雲淡風輕ζ 提交于 2021-02-07 10:57:42
问题 I was viewing the Material docs from Google when I stumbled upon this video. It shows a card item which can be swiped to the right to favourite an item. I want to mirror this behaviour but have failed multiple times. All libraries and tutorials I can find are about swipe-to-delete . I tried to have two views stacked upon each other where the one on top should be swiped so the one below would become visible. I tried to achieve this with the ItemTouchHelper , but this class seems to only be

Why use a CardView instead of a RelativeLayout or LinearLayout?

守給你的承諾、 提交于 2021-02-06 07:01:11
问题 I have a RecyclerView for displaying a list of items. There is this android CardView class given by android to show card layout. If I use a RelativeLayout and set its background to white it works the same way. Also in case of CardView I have to anyway add a childlayout to it which basically contains the all the views inside the card. So I wanted to know if their is any benefit of using a CardView (which actually increases the hierarchy of the views) rather than a normal Layout directly. 回答1:

Why use a CardView instead of a RelativeLayout or LinearLayout?

人盡茶涼 提交于 2021-02-06 06:56:39
问题 I have a RecyclerView for displaying a list of items. There is this android CardView class given by android to show card layout. If I use a RelativeLayout and set its background to white it works the same way. Also in case of CardView I have to anyway add a childlayout to it which basically contains the all the views inside the card. So I wanted to know if their is any benefit of using a CardView (which actually increases the hierarchy of the views) rather than a normal Layout directly. 回答1:

Why use a CardView instead of a RelativeLayout or LinearLayout?

邮差的信 提交于 2021-02-06 06:56:26
问题 I have a RecyclerView for displaying a list of items. There is this android CardView class given by android to show card layout. If I use a RelativeLayout and set its background to white it works the same way. Also in case of CardView I have to anyway add a childlayout to it which basically contains the all the views inside the card. So I wanted to know if their is any benefit of using a CardView (which actually increases the hierarchy of the views) rather than a normal Layout directly. 回答1:

How to add and remove CardView from LinearLayout on button click in android studio?

余生颓废 提交于 2021-01-29 05:35:16
问题 I have a linear layout that contains a cardView. I want to add and delete cardViews dynamically on button clicks. I have tried the following code but the delete button doesn't work moreover the padding of dynamically added view changes on its own after adding a new as shown in picture below. ExperienceInfoActivity.java package kbg.com.kbgpos.forms; import android.app.DatePickerDialog; import android.content.Context; import android.support.v7.app.AppCompatActivity; import android.os.Bundle;

Deleting Card from RecyclerView and re-add it again

∥☆過路亽.° 提交于 2021-01-29 05:34:21
问题 I'm struggling to implement the funtionality to delete an entry of a recyclerview and re-add it again, if the user decided otherwise. For that I'm showing a Snackbar with an undo action. So the flow should be: The user sees a list of Cards which each show some values and an delete button. If the user presses the delete button, the card is deleted and a Snackbar is shown. If the user clicks undo on the Snackbar the Card should be re-added to the RecyclerView . Only if the Snackbar disappears