View and how all controls are aware of the control ID that we set in the layout.
"Attrs.xml file"
# attrs.xml file. <declare-styleable name= "View" > <!--reference represents a resource file!! --<attr name= "id" format= "reference"/> ... (n more info ha, see Code yourself) </declare-styleable>
"The initialization of the View"
public static final int no_id = -1; ... ... @ Viewdebug.exportedproperty (resolveid = true) // (note) android-19/android/view/ viewdebug.java int mid = no_id; // Save control ID, default value -1. ... ... public view (context context, attributeset attrs, int DEFSTYLEATTR) { this (context); // get view. in the Attrs.xml properties file Typedarray a = context.obtainstyledattributes ( attrs, com.android.internal.r.styleable.view, defstyleattr, 0); &NBSP;...&NBSP;...&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;...&NBSP, ..... (N Multiple codes,Omitted!) for (int i = 0; i < n; i++) { int attr = a.getindex (i); switch (attr) { ... .. (n multiple code, omitted!!) case com.android.internal.r.styleable.view_id: // the control ID to get the field in the View id. mID = A.getresourceid (attr, no_id); break;
"Set control ID"
Sets the control ID. public void setId (int id) {MID = ID; if (Mid = = view.no_id && Mlabelforid! = view.no_id) {mid = Generateviewid (); } }
"Get control ID"
Gets the control ID. @ViewDebug. Capturedviewproperty public int getId () {return mID; }
Fff
Fff