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

huangapple 未分类评论52阅读模式
英文:

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

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

  1. import android.app.Activity;
  2. import android.os.Bundle;
  3. import android.view.Window;
  4. import android.view.WindowManager;
  5. public class ActivityName extends Activity {
  6. @Override
  7. public void onCreate(Bundle savedInstanceState) {
  8. super.onCreate(savedInstanceState);
  9. // 去除标题
  10. requestWindowFeature(Window.FEATURE_NO_TITLE);
  11. getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
  12. WindowManager.LayoutParams.FLAG_FULLSCREEN);
  13. setContentView(R.layout.main);
  14. }
  15. }

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

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

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

  1. import android.app.Activity;
  2. import android.os.Bundle;
  3. import android.view.Window;
  4. import android.view.WindowManager;
  5. public class ActivityName extends Activity {
  6. @Override
  7. public void onCreate(Bundle savedInstanceState) {
  8. super.onCreate(savedInstanceState);
  9. // remove title
  10. requestWindowFeature(Window.FEATURE_NO_TITLE);
  11. getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
  12. WindowManager.LayoutParams.FLAG_FULLSCREEN);
  13. setContentView(R.layout.main);
  14. }
  15. }

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

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

答案2

得分: 0

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

  1. <application
  2. android:label=""
  3. (...)
  4. >

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

英文:

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

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

to below:

  1. &lt;application
  2. android:label=&quot;&quot;
  3. (...)
  4. &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://java.coder-hub.com/62075810.html
匿名

发表评论

匿名网友

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

确定