Thursday 11 June 2015

Make full screen activity in android

3 comments
In this android tutorial i explorer how to make full screen activity that will hide such as Actionbar, Titlebar etc. here is very simple way to create full screen activity in android.

In this tutorial we learn two Methods to make Full screen activity in android


Method 1:


We make full screen activity by importing below package in java file:

  1. import android.view.Window;
  2. import android.view.WindowManager;
Let's fun with code

Step 1: Write code into activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="This is a FullScreen activity"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</LinearLayout>

Step 2: Write code into MainActivity.java
package dev.androidapplink.fullscreenactivityapp;

import android.os.Bundle;
import android.app.Activity;
import android.view.Window;
import android.view.WindowManager;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);

}

}
NOTE: No need to change in AndroidManifest.xml

Step 3: Run Your Project:



Method 2:

Step 1: Just set them in AndroidManifest.xml

<activity android:name=".MainActivity"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
</activity>


Enjoy Programming :) 

3 comments :

  1. This comment has been removed by the author.

    ReplyDelete
  2. event manager While it was always challenging enough to satisfy the needs of one audience, now there are two audiences, often with radically different needs from one another, to keep engaged. friend anniversary wishes, happy tuesday quotes and happy mothers day wishes for all moms

    ReplyDelete

Follow me Share