0
android or app in xml
I am learning xml for android in that some of them we have to use android and for some of them we have to use app . Eg: android:layout_height="wrap_content" android:layout_marginLeft="50sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" Could any one explain me where to use android and where to use app.
2 Réponses
+ 6
app namespace is specific to your app itself (the library you import and all the custom attribute you use) but android namespace is specific to only Android SDK.
+ 1
You are talking about custom namespace.In android we can create custom views in additional to already available views. As per in Google developer docs.. To add a built-in View to your user interface, you specify it in an XML element and control its appearance and behavior with element attributes. Well-written custom views can also be added and styled via XML. To enable this behavior in your custom view, you must:
Define custom attributes for your view in a resource element Specify values for the attributes in your XML layout Retrieve attribute values at runtime Apply the retrieved attribute values to your view
Once you define the custom attributes, you can use them in layout XML files just like built-in attributes. The only difference is that your custom attributes belong to a different namespace. Instead of belonging to the http://schemas.android.com/apk/res/android namespace, they belong to http://schemas.android.com/apk/res/[your package name]
So for if you use default views you can use Android namespace