2

I know how to adda scrollbar through the xml properties such that there is a bar in the right side of the edittext field once we write stuff in it by making setSingleline(false).

My question is :-

is there a way to do the same through the activity , that is, dynamically? for eg:-

Code is :-

public class abc extends Activity
{

EditText edit = (EditText)findViewById(R.id.EditText1);

edit.setVerticalScrollBarEnabled(true);

edit.isVerticalScrollBarEnabled();
}

These two does not work. When i add these , i still am not able to see the scrollbar on the rightside of the Edittext when i scroll..

Through XML, when we add :- android:scrollbars="vertical" , then we are able to see the scrollbar..

I am asking for a WORKING way to do it through the activity dynamically or in other words programatically

Please its urgent. I would sincerely be thankful.

1 Answer 1

2

In XML

 android:fadeScrollbars="false"   

Dynamically/programatically:

edit.setScrollbarFadingEnabled(false); 
Sign up to request clarification or add additional context in comments.

1 Comment

Hi, When i do this, i am getting null pointer exception.,.,. could you please make a project with just one activity and xml file and mail me the working project? i am trying for the past 4 hours and i have googled almost everything still not able to work it dynamically my mail id :- [email protected]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.