Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i disable a scrollview?

Tags:

android

I am using relativelayout and inside it a scrollview and inside it a linear layout and a textview which is ensuring scrolling of textview, but I do not want to scroll the text after the particular condition. So, what can I do for this?

like image 686
Nikki Avatar asked Dec 02 '22 04:12

Nikki


2 Answers

To make the scrollbars invisible use this attribute.

android:scrollbars="none"

Edit:

if there is need of runtime changes on visibility or state of enabling, for that we can use the scrolview.setEnabled(false) or android:enabled=false.

like image 173
Praveen Avatar answered Dec 05 '22 10:12

Praveen


There is no direct way to stop scrollview to scroll but u can do it in other way Like:

//global boolean variable
boolean enable = true;    

scrollview.setOnTouchListener(new OnTouchListener() 
{

   @Override
   public boolean onTouch(View v, MotionEvent event) 
   {

      return !enable;
   }
});

when you set enable variable to true it will start scrolling and when you set it to false it stop scrolling.

like image 27
Saubhagya Chaudhary Avatar answered Dec 05 '22 09:12

Saubhagya Chaudhary