[英]How do I convert my existing two Activities of Android Studio into two fragments so that I can make the Navigation Bar?
I'm new in Android Studio and I've been mostly learning through experimenting so it would be really appreciated if you could explain all the steps please.我是 Android Studio 的新手,我主要通过实验学习,所以如果您能解释所有步骤,将不胜感激。
I already have an app complete which has two Activities which are connected to each other.我已经有一个完整的应用程序,它有两个相互连接的活动。 I made this in an Empty Activity.
我在一个空活动中做了这个。 Now I want to this to have an Navigation Bar, what do I do?
现在我想要这个有一个导航栏,我该怎么办?
I tried making a new Navigation Bar Activity and tried to copy paste everything, it worked for the layout file with the xml file but I can't where I should be putting in my code?我尝试制作一个新的导航栏活动并尝试复制粘贴所有内容,它适用于带有 xml 文件的布局文件,但我无法将我的代码放在哪里? I searched up numerous posts to no avail.
我搜索了很多帖子都无济于事。 My original code had over 300 lines so I really can't write it all over again.
我的原始代码有 300 多行,所以我真的不能重新写一遍。 Can someone please help me out?
有人可以帮我吗?
I'm doing this app in Java.我在 Java 中做这个应用程序。
You'll need to use just one main activity and convert the current activities to Fragments.您只需使用一项主要活动并将当前活动转换为片段。 So if you've not heard of Fragments see here https://www.google.com/url?sa=t&source=web&rct=j&url=https://developer.android.com/guide/fragments&ved=2ahUKEwj7wpaxxJnvAhXCx4UKHf9tAqQQFnoECAMQAg&usg=AOvVaw13OtAaEKbecXytTb4qLxel
So if you've not heard of Fragments see here https://www.google.com/url?sa=t&source=web&rct=j&url=https://developer.android.com/guide/fragments&ved=2ahUKEwj7wpaxxJnvAhXCx4UKHf9tAqQQFnoECAMQAg&usg=AOvVaw13OtAaEKbecXytTb4qLxel
Then you can place a navigation bar widget on the main activity, this can be configured to the amount of fragments you need.然后您可以在主活动上放置一个导航栏小部件,这可以配置为您需要的片段数量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.