Search code examples
androidandroid-activityfullscreenandroid-theme

Make an activity full-screen


I got an activity which i want to be full-screen. I tried to change the theme. But it doesn`t work. Then i tried it programmatically but i doesn´t work neither. Any idea what i did wrong?

public class FullActivity extends AppCompatActivity {

@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_full);

    ImageView imageViewFull;

    imageViewFull = (ImageView) findViewById(R.id.imageViewFull);

    imageViewFull.setImageResource(R.mipmap.ic_launcher);

  }


}

Here u can see a screenshot, titlebar still there

And how i said "NoTitlebar THeme" didn´t work for me.


Solution

  • go to values, then styles.xml and change the first row like this:

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

    And then go to AndroidManifest.xml and at aplication's theme add:

    android:theme="@style/AppTheme"