Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android how to set ScrollBar in Edittext?

Tags:

android

I want to ScrollText in Edittext and also show Scrollbar at corner. I Scroll the text By Using

questionEntry.setScroller(new Scroller(myContext)); 
questionEntry.setMaxLines(1); 
questionEntry.setVerticalScrollBarEnabled(true); 
questionEntry.setMovementMethod(new ScrollingMovementMethod()); 

Scrolling text works, but the ScrollBar isn't visible. How can I make it visible?

like image 896
karthi Avatar asked Jul 02 '11 08:07

karthi


People also ask

How to set ScrollBar for EditText in android?

Please add android:scrollbars="vertical" to your xml code of edit text, and it will work fine. Show activity on this post. EditText dwEdit = (EditText) findViewById(R. id.

How to Create Scroll view in android Studio?

To add multiple views within the scroll view, make the direct child you add a view group, for example LinearLayout , and place additional views within that LinearLayout. Scroll view supports vertical scrolling only. For horizontal scrolling, use HorizontalScrollView instead.

How do I scroll up layout when clicking on EditText?

than change layout design. or if it's possible for you than try this android:layout_height="match_parent" to RelativeLayout and give it a fix id also. maybe it's work for you.


1 Answers

This may help you.

<EditText android:id="@+id/edt_task_disc" android:layout_width="wrap_content"
                      android:layout_height="wrap_content"  android:gravity="top"
                      android:background="@drawable/text_aerea" 
                      android:hint="Task Discription"
                      android:textSize="15sp" android:paddingLeft="5dp"
                      android:maxHeight="35dp"
                      android:scrollbars="vertical"
                      />

Please add android:scrollbars="vertical" to your xml code of edit text, and it will work fine.

like image 112
amity Avatar answered Oct 07 '22 15:10

amity