Kullanıcılar, uygulamanızın ana ekranına geri dönmek için kolay bir yola ihtiyaç duyar. Bunu yapmak için ana etkinlik dışındaki tüm etkinlikler için uygulama çubuğunda bir Yukarı düğmesi sağlayın. Kullanıcı Yukarı düğmesini seçtiğinde uygulama, ebeveyn etkinliğine gider.
Bu sayfada, Jetpack Navigation bileşenini kullanarak bir uygulama çubuğuna nasıl Yukarı düğmesi ekleyeceğiniz gösterilmektedir.
Daha ayrıntılı bir açıklama için NavigationUI ile kullanıcı arayüzü bileşenlerini güncelleme başlıklı makaleyi inceleyin.
Uygulama çubuğunuzu yapılandırma
AppBarConfiguration kullanarak uygulama çubuğunuzu yapılandırın.
AppBarConfiguration bölümünden, uygulama çubuğuna üst düzey hedefleriniz hakkında bilgi verebilirsiniz. Gezinme çekmecesi yapılandırılmışsa üst düzey hedeflerdeki uygulama çubuğunda çekmece menüsü simgesi gösterilir. Gezinme çekmecesi yapılandırılmamışsa gezinme düğmesi üst düzey hedeflerde gizlidir.
Her iki durumda da, diğer tüm hedeflerde Yukarı düğmesi gösterilir. Yukarı düğmesine basıldığında navigateUp() çağrılır.
Aşağıdaki örnekte, AppBarConfiguration kullanılarak bir uygulama çubuğunun nasıl yapılandırılacağı gösterilmektedir:
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-27 UTC."],[],[],null,["# Add an Up action\n\nTry the Compose way \nJetpack Compose is the recommended UI toolkit for Android. Learn how to add components in Compose. \n[Navigate from top app bar →](/develop/ui/compose/components/app-bars-navigate) \n\nUsers need an easy way to get back to your app's main screen. To do this, provide an *Up*\nbutton on the app bar\nfor all activities except the main one. When the user selects the Up button, the app navigates to\nthe parent activity.\n\nThis page shows you how to add an Up button to an app bar using the Jetpack Navigation component.\nFor a more detailed explanation, see\n[Update UI components with NavigationUI](/guide/navigation/navigation-ui).\n| **Note:** We recommend using the Jetpack Navigation component to handle your app navigation. This component handles navigating up from the current screen in your app when the user taps the Up button. To learn more, see the documentation for the [Jetpack Navigation component](/guide/navigation).\n\nConfigure your app bar\n----------------------\n\nConfigure your app bar using an\n[AppBarConfiguration](/reference/androidx/navigation/ui/AppBarConfiguration).\nFrom the `AppBarConfiguration`, you can inform the app bar of your top-level\ndestinations. If the navigation drawer is configured, the drawer menu icon\ndisplays on the app\nbar on top-level destinations. If the navigation drawer isn't configured, the navigation button is\nhidden on top-level destinations.\n\nIn both cases, the Up button displays on all other destinations. Pressing the Up button calls\n[navigateUp()](/reference/androidx/navigation/NavController#navigateUp()).\n\nThe following example shows how to configure an app bar using\n`AppBarConfiguration`: \n\n### Kotlin\n\n```kotlin\n override fun onCreate(savedInstanceState: Bundle?) {\n ...\n val navController = findNavController(R.id.nav_host_fragment_activity_main)\n \n val appBarConfiguration = AppBarConfiguration(\n setOf(\n R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications\n )\n )\n binding.myToolbar.setupWithNavController(navController, appBarConfiguration)\n }\n \n```\n\n### Java\n\n```java\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n ...\n NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main);\n\n AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(\n R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications)\n .build();\n NavigationUI.setupWithNavController(binding.myToolbar, navController, appBarConfiguration);\n }\n \n```"]]