Reference library-a library package and a library control with custom Properties
Generally, when you customize a control Panel and the control has custom attributes (for example, panel: closedHandle = "@ drawable/foot_bar_right "), the reference address for this control needs to be defined in xml (for example: xmlns: panel = "http://schemas.android.com/apk/com.example.view ")
In this way, you can reference custom controls in xml.
<RelativeLayout xmlns: android = "http://schemas.android.com/apk/res/android" // package name of the Panel xmlns: panel = "http://schemas.android.com/apk/com.example.view" android: layout_width = "match_parent" android: layout_height = "match_parent"> // custom control Panel <com. example. view. panel android: id = "@ + id/panel" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_alignParentBottom = "true" android: layout_gravity = "left" panel: closedHandle = "@ drawable/foot_bar_right" panel: content = "@ + id/panelContent" panel: handle = "@ + id/panelHandle" panel: openedHandle = "@ drawable/foot_bar_left" panel: position = "left"> </com. example. view. panel>
However
When the custom control to be referenced is library, and the control also has custom attributes, as shown above (it is in attrs. in xml, the package name cannot be referenced in xml when referenced in a new project.
But reference: xmlns: panel = "http://schemas.android.com/apk/res-auto"
<RelativeLayout xmlns: android = "http://schemas.android.com/apk/res/android" // package name of the Panel xmlns: panel = "http://schemas.android.com/apk/res-auto" android: layout_width = "match_parent" android: layout_height = "match_parent"> // custom control Panel <com. example. view. panel android: id = "@ + id/panel" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_alignParentBottom = "true" android: layout_gravity = "left" panel: closedHandle = "@ drawable/foot_bar_right" panel: content = "@ + id/panelContent" panel: handle = "@ + id/panelHandle" panel: openedHandle = "@ drawable/foot_bar_left" panel: position = "left"> </com. example. view. panel>