I’m modifying the source code of a terminal emulator program for Android that contains the following confusing xml code in the linear layout of main.xml:
<com.vtrandal.bluesentry.EmulatorView
android:id="@+id/emulatorView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
/>
This same xml code also appears in another xml file also in /res/layout along with main.xml. I can see that it appears to begin with a custom tag created using my package name. But why? How is this possible and why would someone want something like this?
When you extend a View to create a custom component, you need a way to add this objects to the xml layout. You do that by using the full class name, including the package name. The link to the dev guide the Nicholas posted previously explains it.
The attributes used inside that tag can be either attributes used for the View you are extending, or custom attributes defined in a new schema.
You can follow a nice tutorial about this here: http://www.anddev.org/creating_custom_views_-_the_togglebutton-t310.html