/** * Inflater indicates expansion. In Android, it indicates expansion. Layoutinflater is similar to * findviewbyid (). The difference is that layoutinflater is used to find and instantiate an XML layout file in the layout folder! * Findviewbyid () is used to find specific widget controls (such as buttons and textview) in a specific XML file ). */ // Layoutinflater is used to associate and instantiate a view object with an XML layout file. Layoutinflater Inflater = (layoutinflater) listviewactivity. This . Getsystemservice (context. layout_inflater_service ); // Layoutinflater is used to associate and instantiate a view object with an XML layout file. View itemview = Inflater. Inflate (R. layout. listview_item, Null ); // After the view object is instantiated, you can use findviewbyid () to find the component with the specified ID in the layout file. Textview Title = (Textview) itemview.findviewbyid(r.id.txt title); textview text = (Textview) itemview.findviewbyid(r.id.txt content );
/** * Inflater indicates expansion. In Android, it indicates expansion. Layoutinflater is similar to * findviewbyid (). The difference is that layoutinflater is used to find and instantiate an XML layout file in the layout folder! * Findviewbyid () is used to find specific widget controls (such as buttons and textview) in a specific XML file ). */ // Layoutinflater is used to associate and instantiate a view object with an XML layout file. Layoutinflater Inflater = (layoutinflater) listviewactivity. This . Getsystemservice (context. layout_inflater_service ); // Layoutinflater is used to associate and instantiate a view object with an XML layout file. View itemview = Inflater. Inflate (R. layout. listview_item,Null ); // After the view object is instantiated, you can use findviewbyid () to find the component with the specified ID in the layout file. Textview Title = (Textview) itemview.findviewbyid(r.id.txt title); textview text = (Textview) itemview.findviewbyid(r.id.txt content );