在android中 getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.text_title); 使用上面的话时 他所产生的并不是把以前的用现在的替换只是用 R.layout.text_title放在了默认样式的上面,如果你想通过一个按钮修改标题
以及view上的消息有两种方法:
private void setCustomTitleFeatureInt(int value) {
try { // retrieve value for com.android.internal.R.id.title_container(=0x1020149)
int titleContainerId = (Integer) Class.forName(
"com.android.internal.R$id").getField("title_container").get(null);
// remove all views from titleContainer
((ViewGroup) getWindow().findViewById(titleContainerId)).removeAllViews();
// add new custom title view
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, value);
} catch(Exception ex) {
// whatever you want to do here.. }
}

这种方法是取消以前的 不过这种方法可靠性不好
2.你可以用隐藏的方式:
findViewById(R.id.custom_title_1).setVisibility(View.GONE);getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_2);

更多相关文章

  1. Android(安卓)spinner 样式及其使用详解
  2. TextInputEditText样式设置
  3. 定义seekbar样式
  4. Android中使用NavigationView实现抽屉侧滑效果中Menu菜单栏设置
  5. Android判断Activity是否全屏的方式!!!(最全)
  6. 定制个性化屏保
  7. [置顶] Android中遇到的需求与解决方案一
  8. android 底部tab
  9. 自定义Toast

随机推荐

  1. android studio 读取短信
  2. android:软件的安装和卸载源代码
  3. React Native与Android之间的通信
  4. android 6.0权限全面详细分析和解决方案
  5. Android获取SD卡视频音频文件
  6. 改变 Android EditText 的边框
  7. Android Sqlite数据库中判断某个表是否存
  8. 8.1 8321平台修改WIFI_ONLY总结
  9. linux tar.gz zip 解压缩 压缩命令
  10. Android app的音视频播放功能