Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.mobile.android > #154285 > unrolled thread
| Started by | Jakub <jak74@interia.pl> |
|---|---|
| First post | 2026-06-23 15:01 +0200 |
| Last post | 2026-06-23 14:09 +0000 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.mobile.android
how to get button max position at recylcerView Jakub <jak74@interia.pl> - 2026-06-23 15:01 +0200
Re: how to get button max position at recylcerView ram@zedat.fu-berlin.de (Stefan Ram) - 2026-06-23 13:59 +0000
Re: how to get button max position at recylcerView ram@zedat.fu-berlin.de (Stefan Ram) - 2026-06-23 14:09 +0000
| From | Jakub <jak74@interia.pl> |
|---|---|
| Date | 2026-06-23 15:01 +0200 |
| Subject | how to get button max position at recylcerView |
| Message-ID | <111e026$1dukm$1@paganini.bofh.team> |
how to get button max position at recylcerView at java or kotlin
[toc] | [next] | [standalone]
| From | ram@zedat.fu-berlin.de (Stefan Ram) |
|---|---|
| Date | 2026-06-23 13:59 +0000 |
| Message-ID | <button-20260623145712@ram.dialup.fu-berlin.de> |
| In reply to | #154285 |
Jakub <jak74@interia.pl> wrote or quoted: >how to get button max position at recylcerView >at java or kotlin | Here is how to reword your question into clear, professional English: | | Option 1 (Direct and natural): | | "How do I find the maximum scroll position of a button inside a | RecyclerView using Java or Kotlin?" | | Option 2 (Short and technical): | | "How to get the maximum scroll position for a button in a RecyclerView | (Java/Kotlin)?" | | Quick Technical Solutions | | Depending on what you mean by "max position," here are the two most | common solutions: | | 1. Find the last visible item position | | If you want to know when the user scrolls to the very bottom where a | button might be hidden, use the layout manager. | | Kotlin: | | val layoutManager = recyclerView.layoutManager as | LinearLayoutManagerval maxPosition = | layoutManager.findLastVisibleItemPosition() | | Java: | | LinearLayoutManager layoutManager = (LinearLayoutManager) | recyclerView.getLayoutManager();int maxPosition = | layoutManager.findLastVisibleItemPosition(); | | 2. Find the exact X/Y coordinates of a button | | If you need the visual pixel position of a specific button inside a | row, use getLocationOnScreen. | | Kotlin: | | val location = IntArray(2) | | myButton.getLocationOnScreen(location)val x = locationval y = location
[toc] | [prev] | [next] | [standalone]
| From | ram@zedat.fu-berlin.de (Stefan Ram) |
|---|---|
| Date | 2026-06-23 14:09 +0000 |
| Message-ID | <formatting-20260623150735@ram.dialup.fu-berlin.de> |
| In reply to | #154286 |
ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted: >| Kotlin: >| >| val layoutManager = recyclerView.layoutManager as >| LinearLayoutManagerval maxPosition = >| layoutManager.findLastVisibleItemPosition() Sorry, the formatting of source text went wrong! The code parts were meant to read, | Kotlin: | val layoutManager = recyclerView.layoutManager as LinearLayoutManager | val maxPosition = layoutManager.findLastVisibleItemPosition() | Java: | LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); | int maxPosition = layoutManager.findLastVisibleItemPosition(); | Kotlin: | val location = IntArray(2) | myButton.getLocationOnScreen(location) | val x = location | val y = location . My formatting script actually is working fine. The Markdown I got from the chatbot already had joined source code lines into one line.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.mobile.android
csiph-web