android make activity fill screen code example

Example 1: fullscreen activity android

public class ActivityName extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // remove title
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.main);
    }
}

Example 2: making android activity fullscreen android studio

res -> values -> styles.xml
<resources>
	<style name ...>
    	.
    	.
    	.
    	<item name="android:windowFullscreen">true</item>
    </style>
</resources>

Tags:

Java Example