GUI Components 1 Fall 2012 CS 2302 Programming

  • Slides: 7
Download presentation
GUI Components 1 Fall 2012 CS 2302: Programming Principles

GUI Components 1 Fall 2012 CS 2302: Programming Principles

Radio Button § xml file <Radio. Group android: id="@+id/radio. Group 1" android: layout_width="match_parent" android:

Radio Button § xml file <Radio. Group android: id="@+id/radio. Group 1" android: layout_width="match_parent" android: layout_height="wrap_content" android: orientation="horizontal" > <Radio. Button android: id="@+id/radio 0" android: layout_width="wrap_content" android: layout_height="wrap_content" android: checked="true" android: text=“radiobutton" /> …… </Radio. Group> 2 Fall 2012 CS 2302: Programming Principles

Radio Button § . java file 1. Find the Radio. Group using the method

Radio Button § . java file 1. Find the Radio. Group using the method find. View. By. Id 2. Create a class implements the interface Radio. Group. on. Checked. Change. Listener Implement on. Checked. Changed method Bind the listener class to the Radio. Group using the method set. On. Checked. Change. Listener Find the checked Radio. Button ID using the method radiogroupname. get. Checked. Radio. Button. Id(); 3. 4. 5. 3 Fall 2012 CS 2302: Programming Principles

Check Box § xml file <Check. Box android: id="@+id/checkbox 1" android: layout_width="wrap_content" android: layout_height="wrap_content"

Check Box § xml file <Check. Box android: id="@+id/checkbox 1" android: layout_width="wrap_content" android: layout_height="wrap_content" android: layout_gravity="center_vertical" android: text="@string/checkbox 1" /> 4 Fall 2012 CS 2302: Programming Principles

Check Box § . java file 1. Find the Check. Box using the method

Check Box § . java file 1. Find the Check. Box using the method find. View. By. Id 2. Create a class implements the interface Compound. Button. Checked. Change. Listener Implement on. Checked. Changed method Bind the listener class to the Check. Box using the method set. On. Checked. Change. Listener To check whether the Check. Box is checked using the method is. Checked(); 3. 4. 5. 5 Fall 2012 CS 2302: Programming Principles

Seek Bar § xml file <Seek. Bar android: id="@+id/seek. Bar 1" android: layout_width=“fill_parent" android:

Seek Bar § xml file <Seek. Bar android: id="@+id/seek. Bar 1" android: layout_width=“fill_parent" android: layout_height="wrap_content" android: layout_gravity="center_horizontal" android: max="44" android: progress="29" /> 6 Fall 2012 CS 2302: Programming Principles

Seek Bar § . java file 1. Find the Seek. Bar using the method

Seek Bar § . java file 1. Find the Seek. Bar using the method find. View. By. Id 2. Create a class implements the interface Seek. Bar. on. Seek. Bar. Change. Listener Implement on. Progress. Changed method Bind the listener class to the Seek. Bar using the method set. On. Seek. Bar. Change. Listener To check the current progress of the Seek. Bar using the method get. Progress(); 3. 4. 5. 7 Fall 2012 CS 2302: Programming Principles