Junior — Middle
How is image display on the screen achieved through XML data transformation?
sobes.tech AI
Answer from AI
In Android, displaying an image on the screen using XML typically involves using the ImageView widget in a layout file. In XML, you can specify the image source through the android:src attribute, which references a drawable resource.
Example:
<ImageView
android:id="@+id/my_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/example_image" />
When the app runs, the system parses the XML, creates an ImageView object, and loads the specified image from resources, displaying it on the screen. You can also use attributes for scaling and positioning the image within the ImageView.