[英]How to hide application title in Android?
I want to create an application with just the app icon on the title bar and no app name. 我想创建一个仅带有标题栏上的应用程序图标而没有应用程序名称的应用程序。 How can I do it?
我该怎么做?
I have tried to use: 我尝试使用:
requestWindowFeature(Window.FEATURE_NO_TITLE);
but it just removes the title bar and not just the application name. 但它只会删除标题栏,而不仅仅是应用程序名称。
How about this ? 这个怎么样 ?
setTitle("");
...in onCreate()
of any Activity whose title should be empty. ...在标题应为空的任何Activity的
onCreate()
中。 (Or in onCreateView()
of any Fragment: getActivity().setTitle("");
) (或在任何片段的
onCreateView()
中: getActivity().setTitle("");
)
通过在活动上调用getActionBar()
对您返回的ActionBar
实例调用setDisplayShowTitleEnabled(false)
。
I am not opposing , Sir ( Jonik/CommonsWare ) answer , but by doing getActivity().setTitle("")
& setDisplayShowTitleEnabled(false)
you will see app title at the creation of the Activity , i think . 主席先生(Jonik / CommonsWare),我不反对,但是我认为通过执行
getActivity().setTitle("")
和setDisplayShowTitleEnabled(false)
您会在创建Activity时看到应用标题。
but if you perform Sir ( Jonik/CommonsWare ) answer like this , then it will be better 但是如果您执行先生(Jonik / CommonsWare)这样的回答,那会更好
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(hasFocus)
getActionBar().setDisplayShowTitleEnabled(false);
}
Sorry if , it doesnt help you ! 抱歉,它对您没有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.