We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10
SWE2008 ANDROID
PROGRAMMING Module – 3 Android User Interface Design Essentials Introduction • The Android View
• The Android Controls
• The Android Layout
Displaying Text to Users with TextView • One of the most basic user interface elements, or controls, in the Android SDK is the TextView control • TextView control is a child control within other screen elements and controls • with most of the user interface elements, it is derived from View and is within the android.widget package • To display this TextView on the screen, all your Activity needs to do is call the set ContentView() method • Change the text displayed programmatically by calling the setText() method on the TextView object Configuring Layout and Sizing
• Creating Contextual Links in Text
• Retrieving Data from Users with Text Fields • Retrieving Text Input Using EditText Controls • Constraining User Input with Input Filters Designing with Layouts • Creating User Interfaces in Android Application user interfaces can be simple or complex, involving many different screens The term layout is used for two different but related purposes in Android user interface design In terms of resources, the /res/layout directory contains XML resource definitions often called layout resource files These XML files provide a template for how to draw controls on the screen, layout resource files may contain any number of controls The term is also used to refer to a set of ViewGroup classes, such as LinearLayout, FrameLayout, TableLayout, RelativeLayout, and GridLayout Designing with Layouts • Creating Layouts Using XML Resources • Creating Layouts Programmatically Partitioning the User Interface with Fragments
• In Android 3.0 (Honeycomb), the concept of a user interface
component called a Fragment was introduced • Fragments decouple user interface behavior from a specific Activity lifecycle • Fragments were added to the Android SDK at a crucial time when consumers were experiencing an explosion in the variety of Android devices coming to market Defining Fragments • Fragment implementations that have been defined as regular classes within your applica tion can be added to your layout resource files by using the XML tag • This tag has a few important attri butes. Specifically, you will need to set the android:name attribute of the fragment to the fully qualified Fragment class name