-
Star
(167)
You must be signed in to star a gist -
Fork
(150)
You must be signed in to fork a gist
-
-
Save anonymous/cd7fda2fa5c4062acb92 to your computer and use it in GitHub Desktop.
| <LinearLayout | |
| android:orientation="vertical" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content"> | |
| <TextView | |
| android:text="Guest List" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" /> | |
| <TextView | |
| android:text="Kunal" | |
| android:layout_width="wrap_content" | |
| android:layout_height="wrap_content" /> | |
| </LinearLayout> |
Gebrushet
commented
Oct 5, 2024
- Text Views are not centered,
- View Group not identified due to no background color,
- No spacing between Text views.
,there is no forward slash at the top lineaylayout
The code starts with opening tag
the code includes new attribute called : android:orientation
The code has two TextViews as siblings
the code ends with closing tag
View GROUP is linear layout
Vertical Orientation
Two Text view
The parent[LinearLayout] has two TextView as the children and oriented vertical
parent view on the LinearLayout has two TextView and Children and Oriented Vertical
- There is new linear layout keyword.
- There is new android orientation attribute.
- There are two text views inside the linear layout.
- There is new linear layout keyword.
- There is new android orientation attribute.
- There are two text views inside the linear layout.
One parent view: LinearLayout
Two children views: TextView
Linear layout orientation: vertical Height and width: wrap content
Separate opening and closing tag used
Parent view is in Linear layout and Vertical orientation
Within it are 2 child TextViews
Width and Height of both parent and child views is set to automatically resize by the special code wrap_content
linearLayout is a parent view
TextView is a child
- one parent view group
- two child view
View group is a LinearLayout : parent
LinearLayout have orientation : vertical
LinearLayout have heigth and width : wrap_content
ViewGroup it's a element "LinearLayout".
The sentence indicates that the orientation of the childs contained within the ViewGroup, wil be aligned vertically.
The 2 childs elements are "TextView".
What the difference between linearLayout and textView
TextView
· What it is: A widget for displaying text.
· Purpose: Shows text on the screen (like labels, messages, titles).
· Analogy: A single picture frame that holds a photo (text).
· Example usage:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />LinearLayout
· What it is: A layout container for organizing other views.
· Purpose: Arranges child views in a single row (horizontal) or column (vertical).
· Analogy: A shelf that holds multiple picture frames (TextViews, Buttons, etc.) in a line.
· Example usage:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:text="First Item"/>
<TextView android:text="Second Item"/>
<Button android:text="Click Me"/>
</LinearLayout>Key Differences
Aspect TextView LinearLayout
Type View (widget) ViewGroup (container)
Purpose Display text Arrange other views
Children Cannot have child views Can contain multiple child views
Common Use Labels, messages, titles Organizing UI elements linearly