我为我的应用程序制作了自定义标题栏.但是,当应用程序首次加载时,应用程序名称会在文本显示之前显示在标题栏中一会儿.我如何阻止这种情况发生?
我在我的主要活动中设置了自定义标题栏:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mytitle);
Run Code Online (Sandbox Code Playgroud)
mytitle.xml是我设置文本的地方:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTitle"
android:text="my text"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:textAppearance="?android:attr/textAppearance"
/>
Run Code Online (Sandbox Code Playgroud)
我的标题栏背景不闪烁,只是文字.
谢谢.
android ×1