For each widget, only attributes and methods used for information access and modification are shown, not attributes used for styling and positioning.
java.lang.Object android.view.View android.widget.TextView
TextView Reference in Android Developer Website
android:text
// Get text from widget. textView1.getText( ).toString( ); // Set text in widget. textView1.setText(s);
java.lang.Object android.view.View android.widget.TextView android.widget.Button
Button Reference in Android Developer Website
android:text
// Get text from widget. textView1.getText( ).toString( ); // Set text in widget. textView1.setText(s);
java.lang.Object android.view.View android.widget.TextView android.widget.EditText
EditText Reference in Android Developer Website
android:inputText android:textThe value we have seen for the attribute android:inputText is text.
// Get text from widget. textView1.getText( ).toString( ); // Set text in widget. textView1.setText(s);
java.lang.Object android.view.View android.widget.TextView android.widget.Button android.widget.CompoundButton android.widget.CheckBox
CheckBox Reference in Android Developer Website
android:checked android:text
// Check if checkbox is checked. boolean flag = checkBox1.isChecked( ); // Set checkbox to checked (when boolVal == true) // or to unchecked (when boolVal == false). checkBox1.setChecked(boolVal);
java.lang.Object android.view.View android.widget.TextView android.widget.Button android.widget.CompoundButton android.widget.Switch
Switch Reference in Android Developer Website
android:checked
// Check if checkbox is checked. boolean flag = checkBox1.isChecked( ); // Set checkbox to checked (when boolVal == true) // or to unchecked (when boolVal == false). checkBox1.setChecked(boolVal);
java.lang.Object android.view.View android.widget.TextView android.widget.Button android.widget.CompoundButton android.widget.RadioButton
android:checked
// Determine if checkbox is checked. boolean flag = radioButton1.isChecked( ); // Set radio button to the inverse of its // current state. radioButton1.toggle( );
<RadioGroup xmlns: android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <RadioButton android:id="@+id/yes" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/no" android:onClick="onRadioButtonClicked"/> <RadioButton android:id="@+id/no" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/no" android:onClick="onRadioButtonClicked"/> <RadioButton android:id="@+id/maybe android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/maybe" android:onClick="onRadioButtonClicked"/> </RadioGroup>