如何在Android Studio中隐藏应用程序名称?

huangapple go评论63阅读模式
英文:

How can I hide the app name in androidstudio?

问题

Sure, here's the translated content:

我需要帮助,如何在不删除名称的情况下隐藏应用程序名称。

字符串名称 = "app_name"

就像这样。感谢直接的答案。

如何在Android Studio中隐藏应用程序名称?

英文:

i need help how can hide app name without delete name in

string name="app_name"

like this . Thanks for the straightforward answer .

如何在Android Studio中隐藏应用程序名称?

答案1

得分: 1

另一位用户先前提到的,您可以通过编程方式实现:

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class ActivityName extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 去除标题
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.main);
    }
}

或者您可以通过您的 AndroidManifest.xml 文件来实现:

<activity android:name=".ActivityName"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
</activity>
英文:

As mentioned previously by another user, you can do it programatically:

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class ActivityName extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // remove title
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.main);
    }
}

Or you can do it via your AndroidManifest.xml file:

&lt;activity android:name=&quot;.ActivityName&quot;
    android:label=&quot;@string/app_name&quot;
    android:theme=&quot;@android:style/Theme.Black.NoTitleBar.Fullscreen&quot;&gt;
&lt;/activity&gt;

答案2

得分: 0

尝试修改你的应用的 AndroidManifest.xml 文件:

<application
    android:label=""
    (...)
    >

这样,你就不需要修改字符串资源文件中的 &lt;string name="app_name"&gt;app name&lt;/string&gt; 条目了。

英文:

Try to modify your app's AndroidManifest.xml here:

&lt;application
    android:label=&quot;@string/app_name&quot;
    (...)
    &gt;

to below:

&lt;application
    android:label=&quot;&quot;
    (...)
    &gt;

Thus you don't need to touch the entry in &lt;string name=&quot;app_name&quot;&gt;app name&lt;/string&gt;
in the string resource file.

huangapple
  • 本文由 发表于 2020年5月29日 06:49:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/62075810.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定