Activity_main.xml Configuration:
[Html]
<LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Xmlns: tools = "http://schemas.android.com/tools"
Android: id = "@ + id/LinearLayout1"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: orientation = "vertical">
<TextView
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: text = "@ string/hello_world"
Tools: context = ". MainActivity"/>
<! -- Image button -->
<ImageButton
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: src = "@ drawable/home"
Android: contentDescription = "@ string/imagetext"
/>
<! -- Add images and text in the button -->
<Button
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: text = "@ string/textbtn"
Android: drawableRight = "@ drawable/home" <! -- Home here is an image in the drawable folder under the res directory. The specific drawable can be used. -->
/>
<! -- Radio group, single choice button -->
<RadioGroup
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
>
<RadioButton
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: text = "@ string/nan"
/>
<RadioButton
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: text = "@ string/nv"
/>
</RadioGroup>
<! -- Switch Status button -->
<ToggleButton
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: textOff = "open"
Android: textOn = "disabled"
/>
<! -- Checkbox multi-choice button -->
<CheckBox
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: text = "1. Jiangxi"
/>
<CheckBox
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: text = "2. Fujian"
/>
<CheckBox
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: text = "1. Zhejiang"
/>
</LinearLayout>
Strings. xml mainly configures text writing information:
[Html]
<Resources>
<String name = "app_name"> ImageButton </string>
<String name = "hello_world"> image button </string>
<String name = "menu_settings"> Settings </string>
<String name = "title_activity_main"> MainActivity </string>
<String name = "imagetext"> This is an image button </string>
<String name = "textbtn"> button text </string>
<String name = "nan"> male </string>
<String name = "nv"> female </string>
</Resources>