Bazı içerikler en iyi, durum çubuğunda veya gezinme çubuğunda herhangi bir gösterge olmadan tam ekranda deneyimlenir. Videolar, oyunlar, resim galerileri, kitaplar ve sunum slaytları bunlara örnek olarak verilebilir. Bu yönteme yoğun içerik modu denir. Bu sayfada, tam ekrandaki içerikle kullanıcılarla daha derin bir şekilde nasıl etkileşim kurabileceğiniz gösterilmektedir.
![](https://developer.android.com/static/design/media/fullscreen_landing.png?authuser=0&hl=tr)
Yoğun içerik modu, kullanıcıların oyun sırasında yanlışlıkla çıkmaktan kaçınmasına yardımcı olur ve resim, video ve kitapların keyfini çıkarmak için etkileyici bir deneyim sunar. Bununla birlikte, kullanıcıların bildirimleri kontrol etmek, hazırlıksız aramalar yapmak veya başka işlemler yapmak için ne sıklıkta uygulamaya girip çıktığına dikkat edin. Yoğun içerik modu, kullanıcıların sistemde gezinmeye kolayca erişememesine neden olduğundan yoğun modu yalnızca kullanıcı deneyiminin avantajı, fazladan ekran alanı kullanmanın ötesine geçtiğinde kullanın.
Sistem çubuklarını gizlemek için WindowInsetsControllerCompat.hide()
, geri getirmek için WindowInsetsControllerCompat.show()
tuşunu kullanın.
Aşağıdaki snippet'te, sistem çubuklarını gizlemek ve göstermek için bir düğmenin nasıl yapılandırılacağına dair bir örnek gösterilmektedir.
Kotlin
override fun onCreate(savedInstanceState: Bundle?) { ... val windowInsetsController = WindowCompat.getInsetsController(window, window.decorView) // Configure the behavior of the hidden system bars. windowInsetsController.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE // Add a listener to update the behavior of the toggle fullscreen button when // the system bars are hidden or revealed. ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { view, windowInsets -> // You can hide the caption bar even when the other system bars are visible. // To account for this, explicitly check the visibility of navigationBars() // and statusBars() rather than checking the visibility of systemBars(). if (windowInsets.isVisible(WindowInsetsCompat.Type.navigationBars()) || windowInsets.isVisible(WindowInsetsCompat.Type.statusBars())) { binding.toggleFullscreenButton.setOnClickListener { // Hide both the status bar and the navigation bar. windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()) } } else { binding.toggleFullscreenButton.setOnClickListener { // Show both the status bar and the navigation bar. windowInsetsController.show(WindowInsetsCompat.Type.systemBars()) } } ViewCompat.onApplyWindowInsets(view, windowInsets) } }
Java
@Override protected void onCreate(Bundle savedInstanceState) { ... WindowInsetsControllerCompat windowInsetsController = WindowCompat.getInsetsController(getWindow(), getWindow().getDecorView()); // Configure the behavior of the hidden system bars. windowInsetsController.setSystemBarsBehavior( WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE ); // Add a listener to update the behavior of the toggle fullscreen button when // the system bars are hidden or revealed. ViewCompat.setOnApplyWindowInsetsListener( getWindow().getDecorView(), (view, windowInsets) -> { // You can hide the caption bar even when the other system bars are visible. // To account for this, explicitly check the visibility of navigationBars() // and statusBars() rather than checking the visibility of systemBars(). if (windowInsets.isVisible(WindowInsetsCompat.Type.navigationBars()) || windowInsets.isVisible(WindowInsetsCompat.Type.statusBars())) { binding.toggleFullscreenButton.setOnClickListener(v -> { // Hide both the status bar and the navigation bar. windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()); }); } else { binding.toggleFullscreenButton.setOnClickListener(v -> { // Show both the status bar and the navigation bar. windowInsetsController.show(WindowInsetsCompat.Type.systemBars()); }); } return ViewCompat.onApplyWindowInsets(view, windowInsets); }); }
İsteğe bağlı olarak, bir kullanıcı etkileşimde bulunduğunda gizlenmesini ve davranışını belirlemek üzere sistem çubuklarının türünü belirtebilirsiniz.
Hangi sistem çubuklarının gizleneceğini belirtme
Gizlenecek sistem çubuklarının türünü belirtmek için aşağıdaki parametrelerden birini WindowInsetsControllerCompat.hide()
öğesine iletin.
Her iki sistem çubuğunu gizlemek için
WindowInsetsCompat.Type.systemBars()
öğesini kullanın.Yalnızca durum çubuğunu gizlemek için
WindowInsetsCompat.Type.statusBars()
öğesini kullanın.Yalnızca gezinme çubuğunu gizlemek için
WindowInsetsCompat.Type.navigationBars()
simgesini kullanın.
Gizli sistem çubuklarının davranışını belirtin
Kullanıcı etkileşimde bulunduğunda gizli sistem çubuklarının nasıl davranacağını belirtmek için WindowInsetsControllerCompat.setSystemBarsBehavior()
değerini kullanın.
İlgili ekranda tüm kullanıcı etkileşimlerinde gizli sistem çubuklarını göstermek için
WindowInsetsControllerCompat.BEHAVIOR_SHOW_BARS_BY_TOUCH
simgesini kullanın.Herhangi bir sistem hareketinde gizli sistem çubuklarını (ör. çubuğun gizlendiği kenardan kaydırma) göstermek için
WindowInsetsControllerCompat.BEHAVIOR_SHOW_BARS_BY_SWIPE
simgesini kullanın.Gizli sistem çubuklarını, çubuğun gizlendiği kenar çubuğundan kaydırma gibi sistem hareketleriyle geçici olarak göstermek için
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
değerini kullanın. Bu geçici sistem çubukları uygulamanızın içeriğinin üzerini kaplar, belirli bir düzeyde şeffaflık içerebilir ve kısa bir zaman aşımının ardından otomatik olarak gizlenir.