Xmlns in Android
There are three types of xmlns in Android:
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto"
(1)xmlns:android
xmlns:android=" http://schemas.android.com/apk/res/android The role of is
Invalid Sign
This is mainly used to identify the properties of those controls during operation. If you write it wrong, there will be no problem, but there will be problems during operation, indicating that you have not specified the width, etc. This is not networked.
(2)xmlns:apk
The xmlns customized by Android is actually very simple,
The syntax rule is: xmlns: prefix= http://schemas.android.com/apk/res/ Your application package path
Generally, we refer to "APK / res Auto" to enable app to access all resources under res. of course, if you want it to access only one res resource, you only need to refer to "package name / APK / RES / specific attribute folder".
(3)xmlns:tools
In the layout, add code under any XML tag:
xmlns:tools=" http://schemas.android.com/tools "Then we can use the tools provided by Android. Let's take a case in the development process:
Sometimes in the process of laying out an XML, you need to view the text effect of a textview, so you specify Android: text = "customers are fools"; At this time, the product went online. As a result, I forgot to delete this line of code, and the data loading did not reset the text content.
Is this kind of scene embarrassing? Using the tools tag can avoid such embarrassment. We add tools: text = "customers are fools" in the XML layout. The preview will show that customers are fools, but in fact, if it runs, we can't see this text. In addition, the tools: tag supports almost all Android: tags with the same name, such as tools: SRC and tools: textsize. You can explore them yourself. In short, the function of tools is to facilitate developers to preview the XML layout in advance during the development process without affecting the subsequent running results. It is a very convenient tool.