android-cardview

Horizontal and vertical scrolling in android recycler view

此生再无相见时 提交于 2019-12-01 06:01:51
I have a requirement where I need to have horizontal scrolling and vertical scrolling in a recycler view. It is based on the type of data that is coming from server. If the response from server is having first element as an array, i need that to be in a horizontal scrolling list and if the second element is a single object, then i need to show it in card. Similarly the order changes and should reflect in the UI. How can I achieve this. LayoutManager is the class that layout views in RecyclerView . So change recyclerView.setLayoutManager(LayoutManager) if you want to change layout. In your case

Horizontal and vertical scrolling in android recycler view

瘦欲@ 提交于 2019-12-01 03:14:30
问题 I have a requirement where I need to have horizontal scrolling and vertical scrolling in a recycler view. It is based on the type of data that is coming from server. If the response from server is having first element as an array, i need that to be in a horizontal scrolling list and if the second element is a single object, then i need to show it in card. Similarly the order changes and should reflect in the UI. How can I achieve this. 回答1: LayoutManager is the class that layout views in

ExpandableTextView in CardView to Open and Close with Click Android

别等时光非礼了梦想. 提交于 2019-12-01 02:03:55
I have a CardView which has ExpandableTextView as Child of CardView when i was clicked on CardView the Expandable Text View expand and also in next click it was closed but the Main Problem is that When I click to Expandable Text View it was expanded and also some of other CardView's Expandable TextView in the RecycleView also expanded without clicked on that CardView. i was searched for the reason but not able to get any proper solution and i am new in development of Material's concept Layout So Please help me in My Following code. Thanks in Advance. The following is my code for RecycleView

How to make span count and icon size automatic

不打扰是莪最后的温柔 提交于 2019-12-01 01:42:30
I am using recycler view with card view to show icons in my application. I am not able to figure out how to resize the app icons and increase/decrease the span count automatically depending on the screen size. Here is what I am doing to display it and the spen count is fixed to 3. RecyclerView mrv = (RecyclerView) findViewById(R.id.recyclerview_id); RecyclerViewAdapter myAdapter = new RecyclerViewAdapter(this, lsStore); mrv.setLayoutManager(new GridLayoutManager(this, 3)); mrv.setAdapter(myAdapter); The XMLs are below <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView

ExpandableTextView in CardView to Open and Close with Click Android

核能气质少年 提交于 2019-11-30 20:50:40
问题 I have a CardView which has ExpandableTextView as Child of CardView when i was clicked on CardView the Expandable Text View expand and also in next click it was closed but the Main Problem is that When I click to Expandable Text View it was expanded and also some of other CardView's Expandable TextView in the RecycleView also expanded without clicked on that CardView. i was searched for the reason but not able to get any proper solution and i am new in development of Material's concept Layout

getAdapterPosition() not returning position of item in RecyclerView

送分小仙女□ 提交于 2019-11-30 19:52:01
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 or isn't used correctly. My adapter: public class RVAdapter extends RecyclerView.Adapter<RVAdapter

How to add CardView attributes to app theme?

守給你的承諾、 提交于 2019-11-30 19:24:34
My question is similar to " How to put a CardView attribute in a style ", but I need to go deeper. I'm using AppCompat theme, and my styles looks like style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorPrimary">@color/toolbar_color</item> <item name="android:listViewStyle">@style/CustomListView</item> </style> and I create separate style for CardView <style name="CustomCardView" parent="CardView"> <item name="cardBackgroundColor">@color/card_background</item> <item name="cardCornerRadius">@dimen/card_corner</item> </style> Can I attach it to main style? public

No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating')

风流意气都作罢 提交于 2019-11-30 17:01:54
I am getting these two error messages when trying to compile: /Users/dericw/coding/myApplication/lfdate/android/app/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.2.1/res/values-v23/values-v23.xml Error:(3, 5) No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating'). Error:Execution failed for task ':app:processDebugResources'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/dericw/Library/Android/sdk/build-tools/23.0.2/aapt'' finished

Load a fragment on clicking CardView from RecyclerView

假如想象 提交于 2019-11-30 15:57:45
问题 I've a RecyclerView and CardView inside it. Now what i want to do is load a simple Fragment on clicking the CardView. I'm not able to do that with FragmentManager or SupportFragmentManager. Please give me some directions. My RecyclerViewAdapder and ViewHolder are .. public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder> { private String[] eventName; private String[] eventBrief; public static class ViewHolder extends RecyclerView.ViewHolder { public

CardView has extra margin in each edge on Pre-Lollipop

余生颓废 提交于 2019-11-30 11:42:33
问题 Here are two pictures. on Lollipop: on Pre-Lollipop: we can see that it's just close to the screen side on Lollipop. that's what I want. but on the Pre-Lollipop device, it has extra margin to the screen edge. do you guys have any experience ? thank you. here is the layout xml: <android.support.v7.widget.CardView android:id="@+id/card_title_schedule" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft=