May 16 |
8:50 AM |
Mark M. |
has entered the room |
May 16 |
8:55 AM |
Mark M. |
turned on guest access |
May 16 |
9:05 AM |
terence |
has entered the room |
terence |
hi
|
Mark M. |
hello terence!
|
Mark M. |
how can I help you today?
|
May 16 |
9:10 AM |
terence |
my layout contains a scrollview with a LinearLayout. This LinearLayout has a cardview that I'd like to scroll to the top programatically. I tried Completable.fromRunnable({ scroll_view.smoothScrollTo(0, card_view.top }).subscribe() and nothing happens
|
Mark M. |
are you sure that you are getting control in that lambda expression?
|
Mark M. |
if you are, is card_view.top returning the value that you expect?
|
terence |
yes to both
|
Mark M. |
I have not used smoothScrollTo() on a ScrollView, so I am not certain whether there are any particular problems with it
|
Mark M. |
if you switch to scrollTo(), does that work? it may not be what you want, but it would be a possibly-useful clue
|
terence |
let me try
|
May 16 |
9:15 AM |
terence |
clicking on the card_view takes you to a selection screen. when you select something, you add to a list the sits at the bottom of the card_view. That is why I want to scroll the card_view to the top. scrollTo did not work
|
Mark M. |
you might be better off switching to RecyclerView and updating your adapter, rather than manually adding things to the layout
|
terence |
i am using that
|
Mark M. |
since RecyclerView knows how to scroll, where does the ScrollView come into play?
|
terence |
There are other items on the screen above this card_view
|
Mark M. |
aren't they just items in the RecyclerView?
|
Mark M. |
while Google has tried to get nested scrolling things to work (e.g., NestedScrollView), personally I try to avoid them
|
May 16 |
9:20 AM |
terence |
perhaps i neeed to use nestedscrollview
|
Mark M. |
if you are using a ScrollView inside of a RecyclerView, I could see where that might cause problems
|
Mark M. |
and NestedScrollView might help
|
terence |
I am using a recylclerview in a scrollview
|
Mark M. |
that too might need to switch to NestedScrollView, though personally I would try to eliminate the ScrollView entirely and put everything into the RecyclerView
|
terence |
alright
|
Mark M. |
as a user, I get irritated when things scroll oddly (e.g., you swipe in one spot and the whole thing scrolls; you swipe in a different spot and only part of the stuff scrolls)
|
Mark M. |
and that's why I try to avoid nested scrolling things, beyond any programming challenges
|
Mark M. |
(note: my concern is scrolling in the same direction -- having a mix of horizontal and vertical scrolling nested is less of an issue)
|
terence |
thanks
|
terence |
that was my only question
|
Mark M. |
OK, sorry I did not have a "magic bullet" solution for you
|
terence |
it's ok
|
terence |
has left the room |
May 16 |
9:55 AM |
Mark M. |
turned off guest access |