gpt4 book ai didi

android - 在每个 Activity 中显示抽屉导航 - android studio

转载 作者:行者123 更新时间:2023-11-29 01:16:26 25 4
gpt4 key购买 nike

我有一个问题...我正在android studio中开发一个应用程序。与此同时,它已经有一个抽屉导航。但问题是,它只出现在主屏幕上。当它转到另一个屏幕,不显示抽屉导航。我是 android studio 的新手,但我知道一些 Java 语言。任何人都可以帮助我提供任何可以帮助我在我的应用程序的所有幻灯片和页面中显示抽屉导航的东西。

最佳答案

来自文档

Navigation Drawer

The navigation drawer is a panel that displays the app’s main navigation options on the left edge of the screen. It is hidden most of the time, but is revealed when the user swipes a finger from the left edge of the screen or, while at the top level of the app, the user touches the app icon in the action bar.

要实现您的要求,您必须使用 Fragments

Fragment represents a behavior or a portion of user interface in an Activity. You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities. You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own input events, and which you can add or remove while the activity is running (sort of like a "sub activity" that you can reuse in different activities).

更多细节请看这个例子

1. Navigation Drawer - android hive

2. Navigation Drawer exp 2

3. Navigation Drawer exp 3

也引用这个答案

Answer

关于android - 在每个 Activity 中显示抽屉导航 - android studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39262637/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com