android4.0自定义标题报错 -----断点记录

 1:AndraoidMainfest中 activity的样式设置 android:theme="@android:style/Theme.NoTitleBar"

  2:代码部分

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);  //会与 android:theme="@android:style/Theme.NoTitleBar"冲突,只能存在一个

setContentView(R.layout.activity_dataentering);

getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,

R.layout.top_title);

解决办法:

1:androidMainfest中activity的样式设置为 android:theme="@style/android:Theme.Light"

2:代码

            requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);  

setContentView(R.layout.activity_dataentering);

getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,

R.layout.top_title);

猜你喜欢

转载自zengyan2012.iteye.com/blog/1779772