Android RecyclerView's parent onClick - android

I have a CardView that has some children and also a RecyclerView with android:layout_height="wrap_content". I have onClickListener on this CardView and it works fine until I click on the RecyclerView. Only CheckBoxes in its items need to be clickable. Could you please tell me how I make it works? Preferably in Kotlin
Here is a representing image of my layout:

Related

How to make row list using recyclerView and card? Can I use Nested RecyclerView?

I'm trying to design a row list using RecyclerView like Android TV ↳ android.support.v17.leanback.widget.ListRow. I'm able to design list with title but not row list. Can anyone help me?
Please Follow this Link for
Recycer view like play store
Use Two RecyclerView Outer Recycler is vertical and Second horizontal recycler is item of first recycler View
All you need is to call mInnerRecycler.setNestedScrollingEnabled(false); on your inner RecyclerViews and use Horizontal scrollview as root of mInnerRecyclerView
Explanation:
RecyclerView has support for nested scrolling introduced in API 21 through implementing the NestedScrollingChild interface. This is a valuable feature when you have a scrolling view inside another one that scrolls in the same direction and you want to scroll the inner View only when focused.
In any case, RecyclerView by default calls RecyclerView.setNestedScrollingEnabled(true); on itself when initializing. Now, back to the problem, since both of your RecyclerViews are within the same ViewPager that has the AppBarBehavior, the CoordinateLayout has to decide which scroll to respond to when you scroll from your inner RecyclerView; when your inner RecyclerView's nested scrolling is enabled, it gets the scrolling focus and the CoordinateLayout will choose to respond to its scrolling over the outer RecyclerView's scrolling. The thing is that, since your inner RecyclerViews don't scroll vertically, there is no vertical scroll change (from the CoordinateLayout's point of view), and if there is no change, the AppBarLayout doesn't change either.
In your case, because your inner RecyclerViews are scrolling in a different direction, you can disable it, thus causing the CoordinateLayout to disregard its scrolling and respond to the outer RecyclerView's scrolling.
Notice:
The xml attribute android:nestedScrollingEnabled="boolean" is not intended for use with the RecyclerView, and an attempt to use android:nestedScrollingEnabled="false" will result in a java.lang.NullPointerException so, at least for now, you will have to do it in code.
RecyclerView can check View Type for return header or item. And use layout manager for manage how to item scrolling direction.
RecyclerView (vertical scrolling)
- item -> RecyclerView (horizontal scrolling) check view type is header or item with condition example : is object has type header
Ref : Google play store like interface using recycler view

How to show staggred gridImageView inside cardview in Recyclerview Case

I want to implement image recyclerView (Staggered layout manager) inside cardView which teh cardView is item on recyclerView. I have a question when I build. Shall I call recyclerView adapter class inside class ViewHolder? or making custom adapter class so that I can call at one activity class? or Any suggestion?
This design describes my output expectation
Create a Recycler view like always and with his adapter, in the layout of the item for the recycler just add an ImageView to set with the picture
In the layout of the MainActivity you can use of layout parent the CardView with orientation vertical, and inside you will add the recyclerView and the TextView, both with height 0dp, and you'll add a weight of 0.8 for the Recycler View and weight of 0.2 for the TextView
When you set in the java the adapter of RecyclerView, you need to say in Grid(2) for be just 2 column
and it's done, I hope this can help something

Dynamic grid layout in recycler view

I get the json with the header values as category.
I need to split those category as displayed in the image attached
Can any one suggest how to achieve this view using recyclerview
?
There is no need to create multiple RecyclerView as it can be done with a single one. You should create one RecyclerView. Inside its item's custom layout, your should add RadioButton, TextView and 'GridView' and
you should use GridView inside your list item as following
<GridView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:numColumns="3"
/>
It will have three columns as needed and height as wrap_content so that it can be expanded as needed.
I have a solution.
If don't get it then just ignore this answer.
1) First take one parent Recyclerview Which will consist of other RecyclerView as you need.
2) Create main adapter which will handle parent RecyclerView in which your sub RecyclerViews will be loaded as RecyclerView items.
3) Create adapter for sub RecyclerView which will assign these grid items.
4) Set layout of main RecyclerView as Vertical by LinearLayoutManager.VERTICAL and in sub RecyclerView layout should be a GridLayout.
5) For layout item of main parent RecyclerView should be a layout file with a simple RecyclerView in it, and for sub RecyclerViews, layout should be this item you want.
I hope you get this.
For further queries, please ask.
Happy to help.
Thank you.

Recyclerview inside recyclerview dpad navigation not working on android tv

I created one recyclerview inside that recyclerview each row have a horizontal recyclerview. Now when I try to move through child recyclerview(horizontal recyclerview) I am not able to do. I added the requestfocus and focusable= true.
Still not able to get the focus.
try putting the following on the recyclerviews
android:descendantFocusability="afterdescendants"

Overlap Item Gridview Android

I'm implementing the UI like the picture below. I'm using gridview to this layout. When user tap the item in gird. It show a circle overlap to the other item. I don't how to do it. at first I define a layout with the circle is gone and add onclicklistener. If user tap on that, I visible the circle, but the size of gridview also extend. Can you help me provide solution?
You can add this views in gridview parent layout preferable relative layout. You must add them after your grid view initsialisaton is done and onitemclick listener on grid item to make them visible. Exactly the one you've tryed but not in grid view but in the activity rootlayour.

Categories

Resources