android - 无法在 Android 应用程序中看到应用程序名称
问题描述
我没有在操作栏中获得我的应用程序名称。
所以请帮助我了解它被隐藏的原因以及如何解决这个问题。
这是我的代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:id="@+id/my_Toolbar"
layout="@layout/my_toolbar"
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/appBarLayout"/>
</RelativeLayout>
解决方案
在清单文件中在相应的活动处添加标签,例如:
<activity
android:name=".MainActivity"
android:label="app_name"
您还可以在活动中以编程方式设置标题:
getSupportActionBar().setTitle("My app name");
推荐阅读
- django - Django DetailView 查询集返回一个空列表
- c# - Sharepoint PNP Core C# 如何访问客户端页面 Web 属性数组
- python-3.x - 如何将嵌套字典转换为熊猫数据框
- arrays - 有一个字符串函数可以添加到 char 数组的末尾,同时保留空终止符?
- c - CS50 Pset 1 现金发行
- python - 使用并行性崩溃的程序:没有 gil 就不允许丢弃拥有的 Python 对象
- python - Dockerized Django - 运行 manage.py 导致分段错误
- python - 有什么方法可以拦截和“更改”python 请求响应正文?
- java - 如何在测试运行器文件中不提供特性和胶水路径的情况下运行 bdd cucumber 5.6
- django - Django - 我可以在运行 collectstatic 后删除应用程序静态文件吗