0% found this document useful (0 votes)
3 views2 pages

Android TextView and EditText Example

The document describes how to create an Android application with a RelativeLayout containing two TextViews with text and one EditText. The XML layout code is provided to define the RelativeLayout structure and properties of the TextViews and EditText. The Java code simply sets the content view to the XML layout and hides the action bar.

Uploaded by

Mohd Uwais
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Android TextView and EditText Example

The document describes how to create an Android application with a RelativeLayout containing two TextViews with text and one EditText. The XML layout code is provided to define the RelativeLayout structure and properties of the TextViews and EditText. The Java code simply sets the content view to the XML layout and hides the action bar.

Uploaded by

Mohd Uwais
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Create an Android Application which show the TextView and Edit Text

bar.
XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fae500"
tools:context=".Home">

<TextView
android:id="@+id/t1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="30dp"
android:fontFamily="serif"
android:textColor="@color/colorPrimary"
android:text="Text view" />

<TextView
android:id="@+id/t2"
android:layout_marginTop="100dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="40dp"
android:fontFamily="serif"
android:textColor="#ff0004"
android:text="Mohammad Uwais" />

<TextView
android:id="@+id/t3"
android:layout_below="@+id/t2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="100dp"
android:textSize="30dp"
android:fontFamily="serif"
android:textColor="@color/colorPrimary"
android:text="Edit view" />

<EditText
android:id="@+id/e1"
android:layout_below="@+id/t3"
android:layout_marginTop="40dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>

</RelativeLayout>

JAVA
package [Link].home2;

import [Link];
import [Link];

public class Home extends AppCompatActivity {


@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_home);
getSupportActionBar().hide();
}
}

You might also like