Jump to content
Android Forum - A Community For Android Users and Enthusiasts

Scrollbar in a EditText dynamically/programmatically in Android


rahul.r4
 Share

Recommended Posts

I know how to add a scrollbar through the xml layout properties such that there is a bar in the right side of the Edittext field once we write code 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 functions 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 without adding any code in the layout file

Please its urgent. I would sincerely be thankful. 

  •  

scrollbar.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...