Before starting chapter 3. I hope you have read basic set up ANDROID FOR BEGINNER CHAPTER 2 : INTRODUCTION OF BASIC UI COMPONENTS . Here we will just focus on basic about TextView only. Android system provides us TextView, from where we can display text into the screen. Although it contains text editing operations, the basic class does not allow editing, so EditText class is provided for this reason.
Step 1 : Edit activity_main.xml
Before adding textview in xml
After adding textview in xml
Step 2 : add activity_main.xml to MainActivity.java
Now add activity_main.xml to MainActivity.java so that you can see that in you device.
Now run your code from upper tools there would be a button called Run select device and see the result.
Step 3: Now try other attributes of TextView
Please give me your feedback in comment box so that I can do more hard work for making his more easier to understand.
Step 1 : Edit activity_main.xml
Before adding textview in xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="app.androidlad.iamandroidbeginner.MainActivity">
</RelativeLayout>
After adding textview in xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="app.androidlad.iamandroidbeginner.MainActivity">
<TextView
android:text="Hello World!"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
Step 2 : add activity_main.xml to MainActivity.java
Now add activity_main.xml to MainActivity.java so that you can see that in you device.
Now run your code from upper tools there would be a button called Run select device and see the result.
![]() |
Hello Word |
Step 3: Now try other attributes of TextView
Please give me your feedback in comment box so that I can do more hard work for making his more easier to understand.
ConversionConversion EmoticonEmoticon