Widget properties: XML layout vs code

Just stumbled upon another annoyance: you can’t trust XML properties. Let’s take the EditText. We could try to disable dictionary suggestions:


Well does it work? Probably not, at least not with the devices I tested. But when we do exactly the same in code:


It works like a charm! Documentation says clearly that these two are equivalent:


Can be combined with text and its variations to indicate that the IME should not show any dictionary-based word suggestions. Corresponds toTYPE_TEXT_FLAG_NO_SUGGESTIONS.

Well, not quite… 🙂 


One thought on “Widget properties: XML layout vs code

  1. This is soooo silly! I wasted at least couple of hours to figure out this. For some reason all the values you set to inputType property via XML layout are greater than their actual value in code by 1. For example: textPassword results in 129 while InputType.TYPE_TEXT_VARIATION_PASSWORD is equal to 128. The same with all the rest.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s