Adapter detect clicked component android - java

I have a listview combined with an adapter.
In my listview I have multiple elements that contains multiple elements.
How do I detect what was clicked in the listitem?
I did it with an onclicklistener on each button in my adapter but isn't there a better way to make everything unclickable except buttons or something?
Thanks in advance

Related

Detect Click Event On ItemDecoration In RecyclerView

I'm using itemdecorations to draw header in my recyclerview.
Is there a way to detect click event on itemdecorations in recyclerview.
P.S: I don't want to make a multiview type adapter.

Can I add onFocusChangeListener to sub item of ListView?

I want add focus change listener to sub item of my ListView, I have tried listView.setOnFocusChangeListener(), but this just listen to focus move away from listview or move in listview.
I think I find wrong way.setOnItemSelectedListener is OK.

Android - Custom ListView disable scrolling

I have a custom ListView which checks for a value in its adapter, and if its false it should disable scrolling. The reason I need to do this is because inside the listview are rows of horizontal listviews (using this implementation: https://github.com/dinocore1/DevsmartLib-Android) and if you scroll slightly up or down whilst scrolling on of these horizontal views, they stop scrolling and the listview instead scrolls.
The issue with this code is that it doesn't always seem to prevent the listview from scrolling, and it also doesn't pass the action through to the child (horizontal listview) like I believe it should (passing false).
Does anyone have any idea how I can get it to stop scrolling and still pass the movement action through to the child? Any help would be appreciated.
Thanks.

Using a ListView to lay out a list of checkboxes and text

I need to create a layout with a list of checkboxes on the left and text on the right. However, I need them to be laid out in a very specific way. I've searched for such a layout in many places, but no success (the closest I got to what I want was this.
This is the layout I need for my list
Can I achieve this with a ListView?
You can do it using ListView easily.
You should create your own Adapter and override your getView there
and return a RelativeLayout with your components inside e.g. a Button and a TextView
and set this adapter into your ListView.
Cheers
Create your own layout for each item in ListView and ListAdapter for your ListView
Check this link http://saigeethamn.blogspot.com/2010/04/custom-listview-android-developer.html
Hope this helps you

How to disable scrolling for ListView on Android?

I have the following question: I have a difficult layout that contain ListView. I need disable scrolling ability for ListView, because it's container (root Layout) have had ScrollView already, and I don't need a scrolls for ListView. I disable scrolls by android:scrollbars="none", but abilitity for scrolling would stay. I need that if ListView has 10 items that all items will be shown. How can I do it?
Can't you just use a LinearLayout with 10 elements instead of the ListView? It is not a good idea to have a ScrollView in another ScrollView.
Why do you still use the ListView? Create your own Layout for an item and load it several times (LayoutInflater, .addView(listItem)).

Categories