Android XML attribute style [closed]
Why is it that some attributes like android:layout_width
is put together with an underscore? While e.g android:textColor
is instead using camel-casing?
Why not stick entirely with one style (either underscore or camel-casing)?
These are not cases of different style. The second case is a simple attribute which is used by an element. The first one is an attribute which is assigned to an element, but is used by a layout. This is emphasized by the underscore-separated prefix. If you happen to look at such an attribute as android:layout_marginTop
, you'll see that these two seemingly separate styles are actually parts of a single idea.
精彩评论