Text Fields Text Fields allow users to type text in your application Text Fields have different types like Firstname Lastname Plain Text e Text Field o Person Name 55530100 o Password PAssword Password(Numeric) o email Lorem ipsum dolor sit met consectetur o Phone I Postal Address do esmod tempor o Postal Address 1200am 2011 o multiline text 工 Number Number(Signed) o Time I Number(Decimal) Auto CompleteTextView o Date Multi AutoCompleteTexctView MultiAutoComplete o Number(signed/Unsigned All of the Text Fields mentioned above are merely attributes of edit text http://developer.androidcom/guide/topics/ui/controls/text.html 6
Text Fields • Text Fields allow users to type text in your application. • Text Fields have different types like: o Plain Text o Person Name o Password o Email o Phone o Postal Address o Multiline Text o Time o Date o Number (Signed/Unsigned) • All of the Text Fields mentioned above are merely attributes of EditText 6 http://developer.android.com/guide/topics/ui/controls/text.html
Text view Textview is used to display text on screen a7:51 ol Edit Greeting o EditText. Button are direct subclasses of Hello World Textview Textview doesn 't allow editing in itself It works more like a label Click mel http://developer.androidcom/reference/android/widget/textview.html 7
Text View • TextView is used to display text on screen. o EditText, Button are direct subclasses of TextView. • TextView doesn't allow editing in itself • It works more like a label 7 http://developer.android.com/reference/android/widget/TextView.html
Buttons Buttons allows user to perform some action Android have following button types available, sequence iS Control Name(Class name o Button Button Off o Image Button(Image Button o Toggle Buttons(ToggleButton) ATTENDING? o Radio Buttons(radioButton) O Maybe ON All buttons have different classes and XML tags to represent them unlike the Text Fields(that had only one tag i.e. Edit Text) http://developer.androidcom/guide/topics/ui/controls/button.html 8
Buttons • Buttons allows user to perform some action. • Android have following button types available, sequence is Control Name (Class Name): o Button (Button) o Image Button (ImageButton) o Toggle Buttons (ToggleButton) o Radio Buttons (RadioButton) • All buttons have different classes and XML tags to represent them unlike the Text Fields (That had only one tag i.e. EditText) 8 http://developer.android.com/guide/topics/ui/controls/button.html
Pageview Image View is used to display an image Practises Can load images from various BEEN THERE sources, e.g., drawables/content providers Various other display options available like scaling tinting DONE THAT! 9
ImageView • ImageView is used to display an image. • Can load images from various sources, e.g., drawables/content providers. • Various other display options available like scaling & tinting. 9
6 Packages O com. exampl p□util Rjava co ActivityA Sb Activity B So ActivityC ta BuildConfig R java: hook the resources and java by b a drawable-hdpi b a drawable-ldpi □ drawable-mdpi providing each resource item an ID o drawable-xhdpi b a layout Ovals Reference a resource in java codes liBraries [<package name>.R <resource type>. <resource name> o <package name>: name of the package in which the resource is located (not required when referencing resources from your own package) <resource type: resource type o <resource name>: the resource filename without the extension or the android name attribute value in the xml element findviewbyId(r. id ***) identify a view on Xml by its id setContentView(R layout. ***): apply the layout for the content view 10
• Reference a resource in Java codes o <package_name>: name of the package in which the resource is located (not required when referencing resources from your own package). o <resource_type>: resource type. o <resource_name>: the resource filename without the extension or the android:name attribute value in the XML element. R.java • R.java: hook the resources and java by providing each resource item an ID 10 [<package_name>.]R.<resource_type>.<resource_name> • findViewById(R.id.***): identify a view on XML by its id • setContentView(R.layout.***): apply the layout for the content view