(1) TextView Description: Display text information in activity(2) EditText Description: Editable text box(3) button description: Buttons
1, bind the Listener for button buttons
The variable name (such as Lio) for which the button's ID has been obtained. Setonclicklistener (new Liolistener ());//After New is the name of the rewrite function for the variable name (such as Lio) that corresponds to the ID of the obtained button that we set
2, Listener function
Class Liolistener implements Onclicklistener
{
public void OnClick (View v)
{Construction Method}
}
(4) Menu Description: Menus control(5) Radiogroup and RadioButton Description: Radio button
Note: Two must be used at the same time, because a radio button in a group can only be selected and set multiple groups when you want to set multiple radio buttons for different content
Listeners for radio button groups:
1. Add Listener for Group "Note the difference between adding listeners with a button"
Group name. Setoncheckdchangedlistener (New Radiogroup.oncheckedchangelistener ()
The public void oncheckedchanged (radiogroup group, int checkedid)//GRUOP indicates that the group's controls were clicked, and the ID of that group was passed in, and the checkid indicates that the group passed in the radio button is clicked, the ID of this radio is passed in.
{
if (Femalebutton.getid () ==checkid)//If the ID of the radio button that represents the female is equal to the passed-in ID, ...
{}
Else if (Maelbutton.getid () ==checkedid)//If the ID of the male is equal to the ID passed in, ...
{}
});
(6) CheckBox Description: Multi-select button
To add a listener to a multi-select button
The name of the multi-select button that obtained the ID. Setoncheckedchangelistener (Newcompoundbutton.oncheckedchangelistener ()
public void OnCheckedChanged (Compoundbutton buttonview, Boolean isChecked)
{if (isChecked)
{}
Else
{}});
(7) Toast Description: Give the user the prompt information
Calling code:
Toast.maketext (Radiotest.this, "Famle", Toast.length_short). Show ();
The first parameter is the activity object that is currently used, the second parameter is to look like a message to the user, such as "Famle", the third parameter sets the length of time the information is displayed
Android Common Controls 1