TextView element creates a TextView widget in your UI, and a LinearLayout element creates a LinearLayout view group.
For example, a simple vertical layout with a text view and a button looks like this:
<?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:id = "@+id/text"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:text = "I am a TextView" />
<Button
android:id = "@+id/button"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:text = "I am a Button" />
</LinearLayout>
|
View and ViewGroup objects.
Android provides several app components that offer a standard UI layout for which you simply need to define the content.
These UI components each have a unique set of APIs that are described in their respective documents, such as Adding the App Bar, Dialogs, and Status Notifications.
|
“The more I read, the more I acquire, the more certain I am that I know nothing.” ― Voltaire |