For all menu types, Android provides a standard XML format to define menu items. Instead of building a menu in your activity's code, you should define a menu and all its items in an XML menu resource. You can then inflate the menu resource (load it as a
Menu object) in your activity or fragment.
Using a menu resource is a good practice for a few reasons:
- It's easier to visualize the menu structure in XML.
- It separates the content for the menu from your application's behavioral code.
- It allows you to create alternative menu configurations for different platform versions, screen sizes, and other configurations by leveraging the app resources framework.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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=".CONTACT"
android:padding="16dp"
android:background="@drawable/card"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="20dp"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Contact Us"
android:textSize="22dp"
android:textColor="@color/color2"
android:gravity="center"
android:textStyle="italic"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="90dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:src="@drawable/contact"/>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Punjab Remote Sensing Centre(PRSC)"
android:textColor="@color/color2"
android:gravity="center_horizontal"
android:textSize="20dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="PAU Campus, Ludhiana"
android:textColor="@color/color2"
android:gravity="center_horizontal"
android:textSize="20dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Punjab, India"
android:textColor="@color/color2"
android:gravity="center_horizontal"
android:textSize="20dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Pin- 141004"
android:gravity="center_horizontal"
android:textColor="@color/color2"
android:textSize="20dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Phone: 91-161-2303484"
android:textColor="@color/color2"
android:gravity="center_horizontal"
android:layout_marginTop="20dp"
android:textSize="20dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Email: contact@prsc.gov.in"
android:textColor="@color/color2"
android:gravity="center_horizontal"
android:textSize="20dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:src="@drawable/logo"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
Comments
Post a Comment