Practical No. 5: Develop A Program To Implement Linear Layout and Absolute Layout
Practical No. 5: Develop A Program To Implement Linear Layout and Absolute Layout
Practical No. 5: Develop A Program To Implement Linear Layout and Absolute Layout
Exercise
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Name"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content">
</EditText>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Age"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content">
</EditText>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Mobile No."
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content">
</EditText>
</LinearLayout>
2. Write a program to place Name, Age and mobile number centrally
on the display screen using Absolute layout.
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Name"
android:layout_x="200px"
android:layout_y="561px" />
<EditText
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_x="200px"
android:layout_y="600px" >
</EditText>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Age"
android:layout_x="200px"
android:layout_y="761px"/>
<EditText
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_x="200px"
android:layout_y="800px">
</EditText>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Mobile No."
android:layout_x="200px"
android:layout_y="961px" />
<EditText
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_x="200px"
android:layout_y="1000px">
</EditText>
</AbsoluteLayout>