Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the Fragment element in Android layout written with a lower case 'f'?

All other elements start with an upper case letter, like RelativeLayout, TextView, etc.

Is there a particular reason why the Fragment element is always used as <fragment ... /> instead of <Fragment ... />?

like image 912
Lucas Tulio Avatar asked Feb 22 '14 00:02

Lucas Tulio


1 Answers

Fragments when defined in XML aren't actually views. The full view name is specified, or it assumes android.view for the package and finds the rest. But a fragment is only truly specified when it includes the android:name tag. It acts like a keyword, which are typically written in lower case. Thus, Fragment refers to the class, and fragment is the placeholder in XML for fragments.

As Andrew mentioned in the comments, any special item, such as <include> and <merge> are written in lower case, as they are not android.view's.

like image 82
PearsonArtPhoto Avatar answered Sep 19 '22 07:09

PearsonArtPhoto