Tuesday 11 August 2020

Scrollable readonly EditView in Kotlin

 Scrollable readonly EditView in Kotlin


In the view xml file: 
<EditText
        android:id="@+id/etResult"
        android:layout_width="match_parent"
        android:layout_height="343dp"
        android:background="@color/backgroundColor"
        android:backgroundTint="#00000000"
        android:ems="10"
        android:enabled="true"
        android:fontFamily="sans-serif-condensed"
        android:gravity="start|top"
        android:hint="@string/blankfoldermessage"
        android:importantForAutofill="no"
        android:inputType="none"
        android:paddingTop="2dp"
        android:singleLine="false"
        tools:targetApi="o" />

in the kotlin file (init function): 
etResult.keyListener = null


this will allow the edit text to be multiline, not editable but scrollable. 

No comments:

Post a Comment

Ssh to linux machine without using password

To SSH connect to a linux machine, a raspberry pi in my example from a PC without using a username and password, you can set up SSH key-b...