Text Fields Text Fields allow users to type text in your application. abe Text Fields have different types like: Firstname Lastname o Plain Text 白Form Widgets 321 Text Fields user@domain o Person Name I Plain Text 555)0100 IPerson Name o Password I Password Address I Password(Numeric) o Email IE-mail I Phone Lorem ipsum dolor sit amet consectetur o Phone I Postal Address rMultiline Text o Postal Address 1200am I Time I Date 1/n/2011 o Multiline Text INumber I Number(Signed) o Time 42 I图Number(Decimal) 42.0 o Date a AutoCompleteTextView AutoComplete a:MultiAutoCompleteTextView MultiAutoComplete o Number(Signed/Unsigned) All of the Text Fields mentioned above are merely attributes of EditText http://developer.android.com/guide/topics/ui/controls/text.html
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. ia751 EditGreeting o EditText,Button are direct subclasses of Hello World TextView. TextView doesn't allow editing in itself It works more like a label Click me! ◆ 与 http://developer.android.com/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 On o Image Button(ImageButton) o Toggle Buttons (ToggleButton) ATTENDING? o Radio Buttons (RadioButton) OYes OMaybe ONo All buttons have different classes and XML tags to represent them unlike the Text Fields (That had only one tag i.e.EditText) http://developer.android.com/guide/topics/ui/controls/button.html
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
ImageView ImageView is used to display an image. Practise3 ● 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
Packages T□pp com.example.android.lifecycle P回tet 白u R.java ActivityA ©Activity8 ©a ActivityC BuildConfig ©DialogActivity ER R.java:hook the resources and java by P▣drawable--hdpi ▣drawable-ldpi P▣drawable-mdpi providing each resource item an ID 回drawable-xhdpi P▣layout y回values 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). o <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 0
• 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