Download presentation
Presentation is loading. Please wait.
Published byRosanna Lambert Modified over 9 years ago
1
Android Development: Basic Widgets Richard S. Stansbury 2015
2
Widgets Widgets are display elements that compose the layout of the Android application Common examples: – Labels – Form elements – Images – Maps – etc.
3
Widget Configuration Elements ID – @+id/ for first declaration – @id/ for future declarations – in java you can use: findViewById(R.id. ) Dimensions – layout_width, layout_height Possible values: a dimension, wrap_content, match_parent E.g. <TextView android:id = “@+id/aLabel” android:layout_width=“wrap_content” android:layout_height=“wrap_content”
4
Widget: TextView Displays a text label – Attributes: android:typeface - – See http://developer.android.com/reference/android/graphics/Ty peface.html http://developer.android.com/reference/android/graphics/Ty peface.html android:textStyle – bold, italic, bold_italic android:textColor – RGB or ARGB android:text = “@string/ ” Let’s look at some real examples in Eclipse…
5
Widget:Button Produces a clickable element Common attributes: – Many of the same as TextView – android:onclick=“ ” States click handler method Useful for many simple layouts Not useful for fragments Look at example in Eclipse… Refer to the build task that you had last Friday…
6
Widget:EditText Permits text entry http://developer.android.com/reference/andr oid/widget/EditText.html http://developer.android.com/reference/andr oid/widget/EditText.html Attributes – Many same as TextView – android:inputType – android:hint – android:autotext
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.