1. Hiding the top title bar:
Under our project, find the "themes.xml" or "styles.xml" file in the "values" folder (the file locations are the same, the latter has a higher priority), and then put the following code
<style name="Theme.Intelligent_agriculture" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
change into:
<style name="Theme.Intelligent_agriculture" parent="Theme.MaterialComponents.DayNight.NoActionBar">
//只需要把DarkActionBar修改成NoActionBar
//至于其他代码,保持原来即可
2. Display of the top title bar:
Just reverse the above process
"themes.xml" file location, as shown below:
The result graph is as follows:
3. Modify the title of the top title bar:
First, open the "AndroidManifest.xml" file under the "manifests" folder and set the label of the main startup interface.
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="智慧农业管理"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Intelligent_agriculture">
<activity
android:name=".new_farming"
android:exported="false"
android:label="农事记录">
</activity>
<activity
android:name=".MainActivity"
android:exported="true" //标志为主启动界面
android:label="智慧农业管理">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
//通过:label标签修改
//如果主启动界面没有设置label标签,则APP的名称为application标签的label
//非主启动的Activity没有设置label标签的情况下,默认显示为APP的名称
"AndroidManifest.xml" file location, as shown below: