Tema de Pantalla Completa para AppCompat
Me gustaría saber cómo puedo aplicar el tema de pantalla completa ( sin barra de título + sin barra de acción ) a una actividad. Estoy usando la biblioteca AppCompat del paquete de soporte v7.
He intentado aplicar android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
a mi actividad específica, pero se bloqueó. Creo que es porque mi tema de aplicación es así.
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
También he probado esto
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Que solo oculta la barra de título pero no la barra de acciones. Mi solución actual es ocultar la barra de acción con
getSupportActionBar().hide();
14 answers
Cuando se utiliza el tema.AppCompat en su aplicación puede usar FullScreenTheme agregando el código a continuación a los estilos.
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
Y también mencione en su archivo de manifiesto.
<activity
android:name=".activities.FullViewActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
/>
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-25 12:23:24
Basado en la respuesta de @nebyan, encontré que la barra de acción todavía no se oculta.
El siguiente código funciona para mí:
<style name="AppFullScreenTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
Y por supuesto no se olvidó de editar su archivo AndroidManifest
.
<activity
android:name="YOUR_ACTIVITY_NAME"
android:theme="@style/AppFullScreenTheme"
/>
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-25 19:12:12
<style name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
Usando el xml anterior en estilo.xml, usted será capaz de ocultar el título, así como la barra de acciones.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-07-23 17:48:05
Surgen problemas entre las versiones anteriores y posteriores de Android 4.0 (nivel de API 14)..
Desde aquí https://developer.android.com/training/system-ui/status.html Creé mi propia solución..
@SuppressLint("NewApi")
@Override
protected void onResume()
{
super.onResume();
if (Build.VERSION.SDK_INT < 16)
{
// Hide the status bar
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Hide the action bar
getSupportActionBar().hide();
}
else
{
// Hide the status bar
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
/ Hide the action bar
getActionBar().hide();
}
}
Escribo este código en el método onResume () porque si sales de tu aplicación y luego la vuelves a abrir, ¡la barra de acciones permanece activa! (y así esto soluciona el problema)
Espero que haya sido útil;)
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-08 20:39:50
Su "solución" (ocultando la barra de acción usted mismo) es la forma normal. Pero Google recomienda ocultar siempre la barra de acción cuando la barra de título está oculta. Echa un vistazo aquí: https://developer.android.com/training/system-ui/status.html
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-18 08:50:33
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//to remove "information bar" above the action bar
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
//to remove the action bar (title bar)
getSupportActionBar().hide();
}
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-11-19 12:32:40
Puede seguir el siguiente paso: -
AndoridMenifest.xml
<activity
android:name=".ui.FullImageActivity"
android:label="@string/title_activity_main"
android:screenOrientation="landscape"
android:theme="@style/DialogTheme">
</activity>
Estilo.xml
<style name="DialogTheme" parent="android:Theme.Dialog">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
<!-- No backgrounds, titles or window float -->
<item name="android:windowNoTitle">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowIsFloating">false</item>
</style>
FullImageActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
setContentView(R.layout.image_view);
}
Espero que ayude..¡Gracias!!
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-18 09:50:38
Debería ser parent="@style/Theme.AppCompat.Luz.NoActionBar "
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen"
parent="@style/Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-16 07:05:03
requestWindowFeature(Window.FEATURE_NO_TITLE);
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-01-28 12:42:29
Para eliminar la barra de título en AppCompat:
@Override
protected void onCreate(Bundle savedInstanceState) {
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
}
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-08-04 20:10:01
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-15 12:51:43
¿Solo esto ?
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen">
<item name="android:windowFullscreen">true</item>
</style>
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-06 13:06:21
Este tema solo funciona después de API 21(incluida). Y haga que la barra de estado y la barra de navegación sean transparentes.
<style name="TransparentAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-09-15 09:54:53
Simplemente en este chicos a su Estilo:
<style name="AppTheme" parent="@style/Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item> </style>
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-11-04 21:35:46