Disable EditText editability and focus (like TextView)

后端 未结 7 1370
说谎
说谎 2021-01-02 03:49

Is there a way to make EditText behaviors like TextView in Android (XML is prefered)? I have tried the following:

 android:editable         


        
7条回答
  •  爱一瞬间的悲伤
    2021-01-02 04:07

    If you want an EditText not editable or focusable (just like a TextView) but with the correct background, you can use the attribute ?editTextBackground on a TextView. If you use drawables like @android:drawable/edit_text it will not use a background dependent on the api version.

    This:

      
    

    has the same UI properties of this:

       
    

提交回复
热议问题