android-recyclerview

Remove all items from RecyclerView

限于喜欢 提交于 2019-12-17 10:24:44
问题 I am trying to remove all the elements from my RecyclerView in my onRestart method so the items don't get loaded twice: @Override protected void onRestart() { super.onRestart(); // first clear the recycler view so items are not populated twice for (int i = 0; i < recyclerAdapter.getSize(); i++) { recyclerAdapter.delete(i); } // then reload the data PostCall doPostCall = new PostCall(); // my AsyncTask... doPostCall.execute(); } But for some reason the delete method I created in the adapter is

How to import RecyclerView for Android L-preview

China☆狼群 提交于 2019-12-17 07:16:11
问题 Trying to use the new RecyclerView from the support library. I downloaded the 20 update for the support library using the SDK manager. I've added the jar file to the libs folder - and added to build path - no luck using the RecyclerView. Tried to use also the gradle dependency according to Android Developer's API - not sure if this is the right place to look - this page is related more to AndroidTV : com.android.support:recyclerview-v7:20.0.+ Cannot gradle sync the project. Any ideas? 回答1: I

RecyclerView items with big empty space after 23.2.0

泄露秘密 提交于 2019-12-17 07:14:37
问题 After update to v23.2.0 in my RecyclerView I have items with huge empty vertical space, between the items. My item layout is very simple: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > 回答1: According to the doc With the release 23.2.0 there is an exciting new feature to the LayoutManager API: auto-measurement ! This allows a RecyclerView to size itself based on

match_parent width does not work in RecyclerView

老子叫甜甜 提交于 2019-12-17 07:13:25
问题 My RecyclerView and item has match_parent width but the result is : <view class="android.support.v7.widget.RecyclerView" android:layout_width="match_parent" and items: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:fab="http://schemas.android.com/apk/res-auto" android:id="@+id/ll_itm" android:orientation="horizontal" android:layout_width="match_parent" full: <?xml version="1.0" encoding="utf-8"?> <LinearLayout

Recycle-view inflating different row :- Getting exception while binding the data

纵饮孤独 提交于 2019-12-17 06:56:53
问题 I am working on the Recyceview with different item inflation. When i am NOT binding the data on onBindViewHolder method of RecycleView than it Does not crash.. But when i am binding the data inside the onBindViewHolder than i am getting the Exception , Please check my code and let me know where am i doing wrong. package com.tv.practise.adapter; /** Created by Ravindra Kushwaha on 10/10/16. */ public class RecycleDataAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private

Failed to resolve: recyclerview-v7

无人久伴 提交于 2019-12-17 06:53:39
问题 While adding dependency implementation 'com.azoft.carousellayoutmanager:carousel:1.2.4' to my project, Android Studio throws exception Failed to resolve: recyclerview-v7. Then I tried adding dependency for recyclerview. Still getting same error. apply plugin: 'com.android.application' android { compileSdkVersion 27 defaultConfig { applicationId "com.someapp" minSdkVersion 16 targetSdkVersion 27 versionCode 1 versionName "1.0" vectorDrawables.useSupportLibrary = true } buildTypes { release {

Use RecyclerView inside ScrollView with flexible Recycler item height

自作多情 提交于 2019-12-17 06:38:43
问题 I want to know if there is any possible way to use RecyclerView ? Before this, I used RecyclerView with fixed height inside a ScrollView but this time I don't know the height of the item. Hint : I read all question and solution on stack question before asking this question. update: Some solution show how to scroll RecyclerView on its own but I want to show it expanded. 回答1: If you want to just scrolling then you can use to NestedScrollView instead of ScrollView So you can modify your code

how to highlight the selected Item of Recycler View?

拈花ヽ惹草 提交于 2019-12-17 06:24:23
问题 I have a Recycler View with the Images loaded from the Internal Storage. I want to Highlight the selected item when clicked. I tried a lot of thing but it was not working. Actually what I need is when I click any item in Recycler View that Item must go in My ArrayList and it should also get highlighted and again when I click or say unselect it must again become normal. Here is my Code: public class Images extends Fragment { private List<ImageHolder> imageList; Cursor imageCursor; RecyclerView

Error inflating class and android.support.v7.widget.CardView

僤鯓⒐⒋嵵緔 提交于 2019-12-17 05:07:54
问题 I want to use CardView in my project, but when I run my application, I get the following error. I'm using Eclipse . Error: Error inflating class and android.support.v7.widget.CardView The graphical view of my xml file says 'The following classes could not be instantiated: - android.support.v7.widget.CardView (Open Class, Show Error Log) See the Error Log (Window > Show View) for more details.' Please help. This is the layout for my fragment where I have used CardView <FrameLayout xmlns

CardView layout_width=“match_parent” does not match parent RecyclerView width

情到浓时终转凉″ 提交于 2019-12-17 04:47:41
问题 I have a fragment with contains a RecyclerView with layout_width="match_parent": <android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin"