File Name: activity_main.xml
<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=".MainActivity">
<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/hello"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:textSize="30sp" />
</RelativeLayout>
File Name: MainActivity.java
package com.example.abbu.helloworld;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
File Name: strings.xml
<resources>
<string name="app_name">Hello World</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
</resources>
Output:
 |
Hello World Application in Android
|
No comments:
Post a Comment