Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Unit 4

Designing User Interface with view

Text View

• It displays text to the user

• It is a complete text editor

• Attributes

• android:id – id uniquely identifies the control

• android:capitalize- specifies that the TextView has a textual input method and
should automatically capitalize what the user types

• Values

0 – don’t automatically capitalize

1- capitalize the first word of each sentence

2 – capitalize first letter of each word

3 – capitalize every character

• android:editable – if true, specifies that this TextView has an input method

• android:fontFamily – specifies the font for the string

• android:gravity-specifies how to align the text by the view’s x or y axes

• android:hint – hint text to be displayed when the text is empty

• android:inputType – the type of data being placed in the textfield. Phone, Date, Time,
Number, Password etc

• android:password – whether this text field’s values are to be displayed as password dots
instead of the string. Values – true, false

• android:textStyle –bold, italic or bolditalic for the input text. Values – 0-normal, 1- bold,2-
italic(| can be used for combination)

Example
Edit Text

• It is an over lay over TextView that configures itself to be editable

• It is the predefined subclass of TextView that includes rich editing capabilities

• android:autoText - If set, specifies that this TextView has a textual input method and
automatically corrects some common spelling errors.

• android:text-This is the Text to display.


Button

• android:id -ThisA button is a push button that can be pressed/clicked, by the user to perform
some type of action

• android:id-supplies an identifier name for this view.

• android:onClick - This is the name of the method in this View's context to invoke when the
view is clicked.

• android:text – displays the text on the button


Toggle Button

• It is used to display the checked or unchecked state of a button


• Toggle button is a on/off button with a light indicator, that indicates the current state of a
button

• It allows the user to change the setting between two states

• android:textOff – this is the text for the button when it is off

• Android:textOn – this is the text for the button when it is on

• android:id – id of the view

Radio Button

• Radio buttons allow the user to select one option from a set

• RadioButton are mainly used together in a RadioGroup.

• In RadioGroup, checking one radio button out of several radio buttons added in it will
automatically uncheck all the others.
• It means at a time one can check only one radio button from a group of radio buttons which
belong to same radio group

• RadioButon is a two state button that can be checked or unchecked.

• If a radio button is unchecked then a user can check it by simply clicking on it.

• Once a RadiaButton is checked by user it can’t be unchecked by simply pressing on the same
button.

• It will automatically be unchecked when any other RadioButton is clicked within


same RadioGroup.

• Attributes

• android:id – used to uniquely identify

• Android:text – used to specify the text for radiobutton

• Android:onClick – event handler to be invoked when the button is clicked.

• Android:checked – to specify the status of the radio button values – false/ true
Check Box

• A CheckBox is an on/off switch

• Check-boxes should be used when presenting users with a group of selectable options that
are not mutually exclusive.

• Attributes

• Android:id – specified to uniquely identify the view

• Android:text – text displayed

• Android:onClick –method to be invoked when the check box is clicked

• Android:checked – to specify the status


Progress Bar

• Progress bars are used to show progress of a task

• Eg: When something is uploaded or downloaded from the internet, it is better to show the
progress of download/upload to the user.

• Progress bar supports two modes to represent progress: determinate, and indeterminate.

• Indeterminate mode for the progress bar is to be used when the duration of the operation is
not known.

• Indeterminate mode is the default for progress bar and shows a cyclic animation without a
specific amount of progress indicated.

• Use determinate mode for the progress bar when one wants to show the specific quantity of
progress that has occurred.

• For example, the percent remaining of a file being retrieved

• Indeterminate bar
• Determinate bar to show 25% progress

You might also like