Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mobile Application Development BSCS-7 Lecture # 9

Similar presentations


Presentation on theme: "Mobile Application Development BSCS-7 Lecture # 9"— Presentation transcript:

1 Mobile Application Development BSCS-7 Lecture # 9

2 UI Controls – RatingBar
RatingBar is an extension of SeekBar and ProgressBar that shows a rating in stars. User can touch/drag or use arrow keys to set rating when using default size RatingBar. Smaller RatingBar style ( ratingBarStyleSmall) and larger indicator-only style (ratingBarStyleIndicator) do not support user interaction and should only be used as indicators. Public Methods int getNumStars()Returns the number of stars shown. float getRating()Gets the current rating (number of stars filled). getStepSize()Gets the step size of this rating bar. boolean isIndicator() void setIsIndicator(boolean isIndicator)Whether this rating bar should only be an indicator (thus non-changeable by the user). synchronized void setMax(int max)Set the range of the progress bar to 0... setNumStars(int numStars)Sets the number of stars to show. setOnRatingBarChangeListener(RatingBar.OnRatingBarChangeListener listener)Sets the listener to be called when the rating changes. setRating(float rating)Sets the rating (the number of stars filled). setStepSize(float stepSize)Sets the step size (granularity) of this rating bar.

3 UI Controls - RatingBar
On button click

4 UI Controls - RatingBar
On RatingBar click

5 UI Controls - ListView android.widget.ListView
ListView is a view group that displays a list of scrollable items. List items are automatically inserted to list using an Adapter that pulls content from a source such as an array or database query and converts each item result into a view that's placed into list. Android provides different subclasses for Adapter class that are used to retrieve data. One of these is ArrayAdapter. Toast clicked item value and position ArrayAdapter<String> adapter = new ArrayAdapter <String> (this,R.layout.lstname,strPrograms); lstName.setAdapter(adapter);

6 UI Controls - ListView Toast double-clicked item value and position

7 UI Controls – ImageView
Android.widget.ImageView This class displays an arbitrary image. Add image to Resource Add ImageView from Widgets Important property: ScaleType Add code Important method: setImageResource(Resource ID)

8 To change image on each click

9 To change specific image on click

10 UI Controls – SeekBar Android.widget.SeekBar
It is an extension of Progressbar that adds a draggable thumb. The user can touch the thumb and drag left or right to set the current progress level or use the arrow keys. Interface of SeekBar SeekBar.OnSeekBarChangeListener A callback that notifies clients when the progress level has been changed. Public methods of Interface void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) Notification that the progress level has changed. onStartTrackingTouch(SeekBar seekBar) Notification that the user has started a touch gesture. onStopTrackingTouch(SeekBar seekBar) Notification that the user has finished a touch gesture.

11

12 QUIZ Design the layout of activity containing one button,
Two check boxes and two fragments. By default a blank fragment is displayed. When you click on button, Second fragment will be displayed. Immediately a toast message is displayed indicating both check boxes of MainActivity are checked or not. NOTE: Mention names of each widget with a diagram.

13


Download ppt "Mobile Application Development BSCS-7 Lecture # 9"

Similar presentations


Ads by Google