I have an EditText
set up as follows:
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
android:orientation="vertical" >
<EditText
android:layout_width="match_parent"
android:layout_height="375dp"
android:ems="10"
android:gravity="top">
</EditText>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
At a certain point in the program, after text has been typed, the EditText
becomes disabled by the following code:
edittext.setFocusable(false);
edittext.setEnabled(false);
The problem is that, once the EditText
is disabled, I can't scroll up and down to see what I've written. How do I disable more typing, but still allow for review of what's been written?
Try to set
android:inputType="textMultiLine"
on yourEditText
. Even if I already said in comments: there is a bug on lower API, but with the fixed height maybe it will work.However, if this doesn't work, you should create another view as
TextView
with same properties of theEditText
and also with visibility togone
, as follow:Then, when you handle the
setOnKeyListener
method withKeyEvent.ACTION_DOWN
andKeyEvent.ACTION_ENTER
, you can copy your text inside the textview and remove your edittext:And you can do a reverse method if you need to rewrite your text.
Hope this helps.