Malo
Malo

Reputation: 1576

android how to scroll a view inside NestedScrollView to top of the screen how

I have a NestedScrollView contains LinearLayout with orientation vertical, i have adding multiple views programmatically to the linearLayout, after that i need to click on a specific view inside the nestedScrollView and when clicking i need to make the view scrolling to the top of the screen. i used this but it doesnt work

   val scrollTo: Int = groupView.bottom //groupView is the view i clicked on and i need to scroll it to the top of the screen
   nestedSctollView.smoothScrollTo(0, scrollTo)

Upvotes: 1

Views: 686

Answers (1)

Umesh Patidar
Umesh Patidar

Reputation: 188

try this.

 mNestedScrollView.fullScroll(View.FOCUS_UP);

Upvotes: 0

Related Questions