[Android SDK] Non-editable EditText the right way

I’ve wasted plenty of time doing trial-and-error with incorrect solutions for a non-editable EditText. This one works fine on all my devices:

<EditText
android:id=”@+id/et_address”
style=”@style/NonEditableEditText”
/>

<style name=”NonEditableEditText” parent=”FullW”>
<item name=”android:inputType”>none</item>
<item name=”android:editable”>false</item>
</style>

“FullW” just defines layout_width and layout_height properties.

Have a nice coding day! 🙂

Advertisement

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 )

Facebook photo

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

Connecting to %s