1 / 7

GUI Components

GUI Components. Radio Button. xml file < RadioGroup android:id = "@+id/radioGroup1" android:layout_width = " match_parent " android:layout_height = " wrap_content " android:orientation = "horizontal" > < RadioButton android:id = "@+id/radio0"

tanith
Download Presentation

GUI Components

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. GUI Components Fall 2012 CS2302: Programming Principles

  2. Radio Button • xml file <RadioGroup android:id="@+id/radioGroup1" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <RadioButton android:id="@+id/radio0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text=“radiobutton" /> …… </RadioGroup> Fall 2012 CS2302: Programming Principles

  3. Radio Button • .java file • Find the RadioGroup using the method findViewById • Create a class implements the interface RadioGroup.onCheckedChangeListener • ImplementonCheckedChanged method • Bind the listener class to the RadioGroup using the method setOnCheckedChangeListener • Find the checked RadioButton ID using the method radiogroupname.getCheckedRadioButtonId(); Fall 2012 CS2302: Programming Principles

  4. Check Box • xml file <CheckBox android:id="@+id/checkbox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="@string/checkbox1" /> Fall 2012 CS2302: Programming Principles

  5. Check Box • .java file • Find the CheckBox using the method findViewById • Create a class implements the interface CompoundButton.onCheckedChangeListener • ImplementonCheckedChangedmethod • Bind the listener class to the CheckBox using the method setOnCheckedChangeListener • To check whether the CheckBox is checked using the method isChecked(); Fall 2012 CS2302: Programming Principles

  6. Seek Bar • xml file <SeekBar android:id="@+id/seekBar1" android:layout_width=“fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:max="44" android:progress="29" /> Fall 2012 CS2302: Programming Principles

  7. Seek Bar • .java file • Find the SeekBar using the method findViewById • Create a class implements the interface SeekBar.onSeekBarChangeListener • ImplementonProgressChanged method • Bind the listener class to the SeekBar using the method setOnSeekBarChangeListener • To check the current progress of the SeekBar using the method getProgress(); Fall 2012 CS2302: Programming Principles

More Related