AAD Week4 LDQ
AAD Week4 LDQ
In Android, there are various types of views that can be used to create different
user interface elements in an application. Here are a few examples of different
views in Android:
1. TextView: This view is used to display text on the screen. It can be used for
labels, headings, or any other text-based content.
Example:
<TextView
android:id="@+id/my_text_view"
android:layout_width=“match_parent”
android:layout_height=“wrap_content"
2. EditText: This view is used to allow users to enter text input. It can be used
for login screens, search bars, or any other user input field.
Example:
<EditText
android:id=“@+id/my_edit_text"
android:layout_width=“match_parent"
android:layout_height="wrap_content"
Example:
<Button
android:id=“@+id/my_button"
android:layout_width=“match_parent”
android:layout_height=“wrap_content"
Example:
<ImageView
android:id=“@+id/my_image_view"
android:layout_width=“match_parent"
android:layout_height=“wrap_content”
android:scale_type=“CenterCrop”
android:src=“@drawable/my_image" />
Example:
<ProgressBar
android:id=“@+id/my_progress_bar”
android:layout_width=“wrap_content"
android:layout_height="wrap_content" />
These are some few examples of the different types of views that can be used in
an Android application. By combining these views and using various layout tech-
niques, developers can create a wide range of different user interfaces and user
experiences in their applications.
activity_dummy_layout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/padding"
android:orientation="vertical">
<TextView
android:id="@+id/my_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/padding"
android:textSize="@dimen/txtSize"
android:text="Hello, World!" />
<EditText
android:id="@+id/my_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/padding"
android:textSize="@dimen/txtSize"
android:hint="Enter your name" />
<Button
android:id="@+id/my_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/padding"
android:textSize="@dimen/txtSize"
android:textColorHint="#ffffff"
android:hint="Click Me" />
<ImageView
android:id="@+id/my_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/padding"
android:scaleType="centerCrop"
android:background="@drawable/ic_launcher_background"
android:src="@drawable/ic_launcher_foreground" />
<ProgressBar
android:id="@+id/
m y_progress_bar"
android:layout_mar-
gin="@dimen/padding"
android:layout_width="wrap_con-
tent"
android:layout_height="wrap_con-
tent" />
</LinearLayout>
Output: