I know that is possible to disable editing EditText
.
But, when i disable EditText it also disabled vertical scroll in this text.
Is it possible to disable only editing, but allow scrolling?
I know that is possible to disable editing EditText
.
But, when i disable EditText it also disabled vertical scroll in this text.
Is it possible to disable only editing, but allow scrolling?
editText.setFocusableInTouchMode(false);
editText.clearFocus();
Use this porperties in your EdittText:
android:enabled="true"
android:focusableInTouchMode="false"
android:scrollbars="vertical"
Your EditText will be enable, but not focusable for edit. Then, you will able to scroll (in vertical on this case) and will not able to edit.
I've found that just disabling the key listener, focusable and cursor seems to work:
editText.setKeyListener( null );
editText.setFocusable( false );
editText.setCursorVisible(false);
As long as you keep the edit text enabled you seem to be able to scroll the text still.
editText.setKeyListener(null)
should help you.
If you wrap your EditText
in a ScrollView
then you should be able to preserve the scroll behavior.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText ... />
</ScrollView>
Try to use these two attributes to your editext it will make your editext only scrollable not editable android:inputType="none" android:textIsSelectable="true" Below is the example
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="start"
android:padding="20dp"
android:layout_margin="10dp"
android:textSize="@dimen/text_size"
android:inputType="none"
android:textIsSelectable="true"
android:textStyle="normal"
android:id="@+id/toeditext"
android:textColor="@android:color/white"
/>