Issue
I begin to study Android development. I’ confused about the XML meaning for the UI design. Such as the following code, what the keyword
xmlns,
android,
tools,
app mean ? Are they some objects? For example,
android:layout_width means that the property of the object
android.
<?xml version="1.0" encoding="utf" /> </androidx.constraintlayout.widget.ConstraintLayout>
Solution
As someone answered, ns is a namespace. You can actually call them anything- if you wanted to use "foobar:" instead of "android:" you can, you’d just change xmlns:app to xmls:foobar.
Now there are conventions most people follow, to make code more readable. "android:" is the stuff built into the framework. "app:" are attributes created by your app (or any library you use) and are generated at compile time. "tools:" are meant for things the IDE reads for display, such as default values for preview. Keeping to these names will make it easier for others to read your code.
Answered By – Gabe Sechan
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0