我今天使用名为“AIDE”的应用程序制作了我的第一个应用程序。我是 android 用户,这是我第一次制作应用程序,如何从主屏幕顶部删除我的应用程序名称和标签?我将我的应用命名为“YT Studio”,但我不想在主屏幕上显示这个名称和标签,我希望它是空白的,有人可以帮我吗?我给了你我的android manifest.xml
和main.java
文件作为参考,我很乐意编辑我的问题以获得更多帮助。
安卓清单.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ojhastudios.ytstudio" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="YT Studio"
android:theme="@style/AppTheme"
android:resizeableActivity = "true">
<activity
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
主要的.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp" />
</LinearLayout>
编辑:一个人问我要代码,你去
package com.mycompany.myapp;
import android.app.*;
import android.os.*;
public class MainActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
getSupportActionBar().hide();
}
}
你可以打电话
getSupportActionBar().hide();
在您的活动onCreate()
方法中。
上面给出的方法在使用 AndroidX 活动时不起作用。它适用于AppCompatActivity
.
所以,这个答案将完成任务。
在您的AndroidManifest.xml
中,找到您的活动,然后您应该在其中添加以下行:
<application>
...
<activity
android:name=".MainActivity"
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar">
...
</activity>
...
</application>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句