Unit2_UsingViews
Unit2_UsingViews
Views
View is the basic building block of UI(User Interface) in android. View refers to the
android.view.View class, which is the super class for all the GUI components like
TextView, ImageView, Button etc.
Basic views—Commonly used views, such as the TextView, EditText, and Button
views.
Picker views—Views that enable users to select from a list, such as the TimePicker
and DatePicker views.
List views—Views that display a long list of items, such as the ListView and the
SpinnerView views.
Specialized fragments—Special fragments that perform specific functions.
1
Designing User Interface with Views
2
Designing User Interface with Views
3
Designing User Interface with Views
4
Designing User Interface with Views
TextView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>
5
Designing User Interface with Views
TextView
TextView view is used to display text to the user. This is the most basic view and one
that you will frequently use when you develop Android applications. If you need to
allow users to edit the text displayed, you should use the subclass of TextView—
EditText.
7
Designing User Interface with Views
8
Designing User Interface with Views