android-recyclerview

ViewPager2 with horizontal scrollView inside

柔情痞子 提交于 2020-08-25 07:02:29
问题 I implemented the new ViewPager for my project. The viewPager2 contains a list of fragment private class ViewPagerAdapter extends FragmentStateAdapter { private ArrayList<Integer> classifiedIds; ViewPagerAdapter(@NonNull Fragment fragment, final ArrayList<Integer> classifiedIds) { super(fragment); this.classifiedIds = classifiedIds; } @NonNull @Override public Fragment createFragment(int position) { return DetailsFragment.newInstance(classifiedIds.get(position)); } @Override public int

RecyclerView inside RecyclerView is not scrolling

血红的双手。 提交于 2020-08-24 07:12:04
问题 I have a Recyclerview with GridLayoutManager whose child items may have a vertical RecyclerView inside it. Here is the screenshot: I have created adapters for this scenario. It shows it properly but internal Recyclerview is not scrolling no matter how many items are inside it. Can anyone suggest how to make internal and main RecyclerViews scroll? 回答1: I found the solution. I just had to disable the touch event of the parent in case Recyclerview receives touch event. Here is the code snippet

recycler View Item it is not showing Ripple effect/touch highlight, i applied Listener by using gesture Detractor

走远了吗. 提交于 2020-08-24 03:54:32
问题 recyclerView.addOnItemTouchListener(new MyListClickListener(getContext(), new MyListClickListener.ClickListener() { @Override public void onClick(View v, int position) { TextView textView = (TextView) v.findViewById(R.id.title); Fragment fragment = ((MyPagerAdapter) viewPager.getAdapter()).getFragment(1); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.detach(fragment); fragment.onDestroy(); ft.attach(fragment); ft.commit(); comm.sendData(String.valueOf(textView.getText()

RecyclerView's GridLayoutManager dynamic span count

谁说我不能喝 提交于 2020-08-22 11:56:15
问题 I am using following code dynamically change span count. val layoutManager = GridLayoutManager(this, 3) layoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { override fun getSpanSize(position: Int): Int { when (position) { 0, 1, 2 -> return 1 3, 4 -> return 2 5 -> return 3 else -> return 1 } } } And I got following output. But I want D and E should horizontally equally aligned. I don't how to do it. Actually I have 3 types in adapter, HEADER, TYPE_A, TYPE_B . HEADER

How to disable overscroll effect on RecyclerView ONLY when you can't scroll anyway ?

微笑、不失礼 提交于 2020-08-21 08:03:21
问题 Background Sometimes, all items of the recyclerView are already visible to the user. In this case, it wouldn't matter to the user to see overscroll effect, because it's impossible to actually scroll and see more items. The problem I know that in order to disable overscroll effect on RecyclerView, I can just use: recyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER); but I can't find out when to trigger this, when the scrolling isn't possible anyway. The question How can I Identify that all

How to disable overscroll effect on RecyclerView ONLY when you can't scroll anyway ?

我们两清 提交于 2020-08-21 08:01:43
问题 Background Sometimes, all items of the recyclerView are already visible to the user. In this case, it wouldn't matter to the user to see overscroll effect, because it's impossible to actually scroll and see more items. The problem I know that in order to disable overscroll effect on RecyclerView, I can just use: recyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER); but I can't find out when to trigger this, when the scrolling isn't possible anyway. The question How can I Identify that all

kotlin.TypeCastException: null cannot be cast to non-null type kotlin.collections.MutableList

落花浮王杯 提交于 2020-08-20 13:23:57
问题 please dont marked as duplicate , as the question is slightly different ---> null cannot be cast to non-null type kotlin.collections. MutableList Scenerios :- i have been performing delete cart using retrofit.. if atleast one item is present ,it displays in recyclerview 2.if cart is empty ,it crashes with a above error here is my adapter code:- class CartAdapter(context: Context, dataList: MutableList<DataCart?>) : RecyclerSwipeAdapter<CartAdapter.CustomViewHolder>() { //added

StaggeredGridLayoutManager: Adding Margin makes the layout items pushed to the side

眉间皱痕 提交于 2020-08-20 11:46:05
问题 So, I'm working on a small project and I wanted to add StaggeredGridLayoutManager to the file. While it works if I don't add an itemDecorator and no margin or padding in my layouts. As soon as I add margins it pushes the list to one side. I'm attaching a screenshot to clarify the issue. Here is my Code: recyclerView.setHasFixedSize(true); StaggeredGridLayoutManager gridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL); recyclerView.addItemDecoration(new

retrieve data of specific value in Firebase recycle view in android studio

江枫思渺然 提交于 2020-08-20 11:37:23
问题 i have an e-commerce android app and i have all orders(state = shipped & not shipenter image description hereped) which are received by admin in recycler view from Firebase realtime database. Now, i want to get shipped orders(state = shipped) in another activity and i dont know how to retrieve only those orders which have state = shipped. I have tried several things but cant get around this. So anyone could help please answer. My recyclerView code looks this this: shippedOrdersRef =

Kotlin Recyclerview row item selection background color change

爱⌒轻易说出口 提交于 2020-08-20 11:12:31
问题 I am able to change the color of the text and background of row clicked of my recyclerview in my recyclerview . But my problem is after clicking for example on the 2th item,the 10st item also gets selected.Likewise after clicking my 5th item the 3nd item is selected. How do i solve this? in fact my question is that how to change background color of recyclerview item that click on it in Kotlin ? I also followed the instructions in this link. But it did not worked correctly!! AllChanelAdapter