gpt4 book ai didi

android - activity_main看起来完全不同

转载 作者:行者123 更新时间:2023-12-02 13:15:28 25 4
gpt4 key购买 nike

我在Pluralsight上遵循了这门类(class):
https://app.pluralsight.com/library/courses/getting-started-android-development/table-of-contents
当我使用“基本 Activity ”创建项目时,我的activity_main看起来与他的完全不同。第一个是我的,第二个是他的:
Mine
His
他只有一个具有Text View 的约束布局,但是我有一个协调器布局,一个应用程序栏布局和一个工具栏,以及所有我所不知道的东西。我没有改变我的。由于盗版,我无法在视频中发布其他任何内容,但是如果您愿意,我可以为您提供有关我的项目的更多信息。

最佳答案

各种默认项目模板会不时进行调整和修改。当他们添加了Navigation框架时,他们在这个空白项目中添加了一个基本示例,该示例使用一个按钮在两个片段之间进行交换。
我认为,如果您执行以下操作,它将使您非常接近视频中的开始项目:
用以下内容替换res/values/strings.xml的内容:

<resources>
<string name="app_name">My Application</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world</string>
</resources>
删除 res/navigation目录中的文件。
删除 fragment_first.xml目录中的文件 fragment_second.xmlres/layout
用以下内容替换 content_main.xml的内容。您可以通过按右上角的“代码”按钮切换到代码编辑器。
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<TextView
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
并且不用担心预览不再显示设备的模拟导航栏和状态栏。那不会影响您的工作。

关于android - activity_main看起来完全不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64471479/

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