me.at.coding
me.at.coding

Reputation: 17624

How to find the default style of EditText?

I want to see what exactly the default style for EditText defines. So the first step for me is to figure out, which style is actually the default one.

Checking the EditText source code I found this:

public EditText(Context context, AttributeSet attrs) {
    this(context, attrs, com.android.internal.R.attr.editTextStyle);
}

I think this means the default style is defined as com.android.internal.R.attr.editTextStyle. But where can I find the implementation of this style? And why is it R.attr.editTextStyle?

Upvotes: 1

Views: 661

Answers (1)

snachmsm
snachmsm

Reputation: 19223

attr means AttributeSet - special set with params of Views which is passed in constructor and parsed there. it contains all attributes set by XML or default set when just-Context constructor is used. com.android.internal.R.attr.editTextStyle (and all other R.) are just integer pointers, probably handled in lower layer (View?) extended by TextView

note that com.android.internal.R.attr.editTextStyle is just pointer to style defined by system, so it may differ across versions (especially before Material Design, so 4.x). for example in THIS source editTextStyle is pointing further on Material Design depended (line 244)

<item name="editTextStyle">@style/Widget.Material.EditText</item>

Upvotes: 1

Related Questions