Scroll inside an EditText Android:

In xml file :

<EditText
android:id="@+id/DwEdit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minLines="10"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
android:overScrollMode="always"
android:inputType="textCapSentences"></EditText>

And in Java code Add this piece

EditText dwEdit =(EditText) findViewById(R.id.DwEdit);       
dwEdit.setOnTouchListener(new OnTouchListener(){
public boolean onTouch(View view,MotionEvent event){
// TODO Auto-generated method stub
if(view.getId() == R.id.DwEdit){ view.getParent().requestDisallowInterceptTouchEvent(true);
switch(event.getAction()&MotionEvent.ACTION_MASK){
caseMotionEvent.ACTION_UP: view.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
}
return false;
}
}
);

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s