recyclerview

StaggeredGridLayoutManager and moving items

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have created a very simple project, displaying 28 images with StaggeredGridLayoutManager by recyclerview. but as I scroll the recyclerview it moves items for example from left to right or swap the column of left and right. codes: import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.os.Bundle; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; public class MainActivity extends Activity { String mImageDir; private RecyclerView mRecyclerView;

Android RecyclerView : notifyDataSetChanged() IllegalStateException

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to update the items of a recycleview using notifyDataSetChanged(). This is my onBindViewHolder() method in the recycleview adapter. @Override public void onBindViewHolder(ViewHolder viewHolder, int position) { //checkbox view listener viewHolder.getCheckbox().setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { //update list items notifyDataSetChanged(); } }); } What I want to do is update the list items, after I check a

Android sticky header RecyclerView/ Section Header RecyclerView

匿名 (未验证) 提交于 2019-12-03 02:51:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Hello All I have just created a demo to work with new android L widget RecyclerView.I have also implemented Pull-To-Refresh using SwipeRefreshLayout but problem for me now is how can I implement sticky header here,Because when i try to set mRecyclerView.setOnScrollListener(new OnScrollListener() { @Override public void onScrolled(int arg0, int arg1) { } @Override public void onScrollStateChanged(int arg0) { // TODO Auto-generated method stub } }); I get only these 2 methods so dont have any idea how can I handle this... Please help.. 回答1:

Support RecyclerView doesn't show anything until touched

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using the support RecyclerView in my app, and I see the most bizarre thing. It doesn't display any items until I touch to scroll. Then, all of a sudden, the RecyclerView populates itself. I have verified that the list backing the adapter is populated, and that onCreatViewHolder and onBindViewHolder are never called until a touch event. Here's how I set up the recyclerview: @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { Drawable divider = new ColorDrawable(ProfileInfo.getCurrentProfileColor());

Firebase UI RecyclerView onClick

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using Firebase UI FirebaseRecyclerAdapter to populate a RecyclerView. I managed to get click events from components of my item view (the title), but not for anywhere in the item view, which is what I need. I followed google sample. In my Activity: private void setRecyclerView() { recyclerView = (RecyclerView) findViewById(R.id.recycler_view_gigs); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(this)); mAdapter = new FirebaseRecyclerAdapter<Gig, GigViewHolder>(Gig.class, R.layout.list_item_card,

update RecyclerView with Android LiveData

匿名 (未验证) 提交于 2019-12-03 02:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: There are many examples how to push new list to adapter on LiveData change. I'm trying to update one row (e.g number of comments for post) in the huge list. It would be stupid to reset whole list to change only one field. I am able to add observer onBindViewHolder, but I can't understand when should I remove observer @Override public void onBindViewHolder(ViewHolder vh, int position) { Post post = getPost(position); vh.itemView.setTag(post); post.getLiveName().observeForever(vh.nameObserver); ... } 回答1: Like @Lyla said, you should observe

RecyclerView with different Cardlayouts

匿名 (未验证) 提交于 2019-12-03 02:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: What I'd like to do At the moment I'm playing around with RecyclerView and CardView 's. For now I wrote a RecyclerView.Adapter on which I can display the same CardView multiple times with different content - analog to the ListView with a BaseAdapter . Now I'd like to write a RecyclerView with different CardView-Layout 's (in style of Google Now). I've already searched for tutorials but didn't found anything useful about that topic. Does someone know, how this needs to be implemented? What needs to be done to realize that? 回答1: To achieve

Cannot call notifyItemInserted() from RecyclerView.OnScrollListener

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Recently I upgrade my recyclerview-v7:23 to recyclerview-v7:24.2.0 . My applicaton has an endless scroll list. The error message points to the line notifyItemInserted when I add loading view into RecyclerView (null object it means loading, id 0 is empty, -1 is end of the page) and it works fine before (recyclerview-v7:23) but suddenly I got error like this and somehow my loading show up twice then when it removed one, there is one loading that still visible in the top. W/RecyclerView: Cannot call this method in a scroll callback. Scroll

RecyclerView does not Recycling Views when use it inside NestedScrollView

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using RecyclerView inside NestedScrollView . Also i set setNestedScrollingEnabled to false for recyclerview to support lower API ViewCompat.setNestedScrollingEnabled(mRecyclerView, false); Now! When user scrolled the view every thing seems okay, but!!! views in recyclerview does not recycled!!! and Heap size grows swiftly!! Update : RecyclerView layout manager is StaggeredLayoutManager fragment_profile.xml : <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http:/

RecyclerView onBindViewHolder only called when getItemViewType changes

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a viewholder with multiple viewtypes. When scrolling onBindViewHolder is only called when getItemViewType changes value. This causes my list items to not be updated properly. Is this a bug? Or I'm i doing something wrong here. This seems very strange behaviour from the new recyclerView class. Here is my adapter: package se.davison.smartrecycleradapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.util.SparseIntArray; import android.view.LayoutInflater; import