`
wang_peng1
  • 浏览: 3902856 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

动态的修改自定义custom title

阅读更多
在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);
分享到:
评论

相关推荐

    electron-react-custom-titlebar:使用React的Electron的自定义标题栏

    使用React的Electron的自定义标题栏建立在我的电子React开始模板之上 请用纱如何使用: 克隆或下载仓库“纱线安装” “ yarn electronic-dev”运行开发服务器'yarn electronic-pack [os flag]'为您的操作系统构建...

    透明与窗体的设置

    1)为自定义的Title建立一个layout(custom_title_1.xml) android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> android:layout_width="wrap_content...

    -react_antd_jsx_custom:与antd和jsx基本设置React

    Less等) 添加图像,字体和文件使用public文件夹更改HTML 在模块系统之外添加资产何时使用public文件夹使用全局变量添加引导程序使用自定义主题增加流量添加路由器添加自定义环境变量在HTML中引用环境变量在Shell中...

    jQuery-Alert-Dialogs-Plugin:自定义消息对话框

    jQuery-Alert-Dialogs-Plugin 这是来自 Cory SN LaViska, A Beautiful Site ( ) 的 jQuery 警报的...'这是一个自定义的警报框', 'Title Alert'); jConfirm 确认对话框jConfirm('你能确认一下吗?', '确认对话框',

    hello-react-custom-renderer

    title> 安装依赖项 导入组件 代码分割 添加样式表 后处理CSS 添加CSS预处理器(Sass,Less等) 添加图像,字体和文件 使用public文件夹 更改HTML 在模块系统之外添加资产 何时使用public文件夹 使用全局变量 ...

    Nuxt pages下不同的页面对应layout下的页面布局操作

    有时候我们pages中不同的页面需要不同的个性化布局这时候layout就起作用了 layouts 根目录下的所有文件都属于个性化布局... <div class=title>这里是自定义也页面的头部(布局) <!-- nuxt可以理解为所对应的.vue页

    PKCustomAlertView:PKCustomAlertView是自定义警报视图。 在它的帮助下,用户可以通过修改视图模型属性来根据需要进行自定义

    自定义警报示例代码 PKAlertModel * alertModel = [ [ PKAlertModel alloc ] init ] ; alertModel . alertTitle = @ "Title" ; alertModel . alertMessageBody = @ "Displaying custom alert!" ; alertModel .

    nbhdf5:用于NBODY6的HDF5输出和可视化例程

    对于GPU2版本,修改GPU2 /目录下的``Makefile.build'',将生成规则``gpu''中的编译器``gfortran''更改为``h5pfc'': gpu:$(对象) h5pfc -o nbody6 $(FFLAGS)$(对象)-fopenmp $(LIBCUDA)-lstdc ++ -fPIC ...

    hello-react-native-custom-renderer:React Native渲染器的简单问候世界

    title> 安装依赖项 导入组件 代码分割 添加样式表 后处理CSS 添加CSS预处理器(Sass,Less等) 添加图像,字体和文件 使用public文件夹 更改HTML 在模块系统之外添加资产 何时使用public文件夹 使用全局变量 ...

    EasyRating:只需一个简单的评分组件即可满足您的需求

    包括星号,心形等等,更改文本大小和图标大小,将自定义颜色赋予等级,甚至超越。 易于定制。 安装 `npm i easy-rating-custom --save` 用法 import EasyRating from 'easy-rating-custom' ; function App ( ) { ...

    cms后台管理

    //获取内容列表,可以通过此处进行更改,获取自己数据库中的数据 List<Content> list = getList(params, env); Map, TemplateModel> paramWrap = new HashMap, TemplateModel>( params); //OUT_LIST值为tag_...

    Shewbot-rails

    Settings.site_title - 将站点名称从“Showbot”更改为您想要的任何名称。 Settings.custom_css_url - 在 Bootstrap CSS 之后包含一个用于自定义的样式表。 Heroku 或其他基于环境变量的...环境 无论环境如何,...

    source.zip

    62_自定义窗口标题.avi 所在项目:customtitle 63_PopupWindow.avi 所在项目:PopupWindow 64_ListView数据异步加载与AsyncTask.avi 所在项目:DataAsyncLoad 65_ListView数据的分批加载.avi 所在项目:datapageload...

    8天快速掌握Android教程源码

    62_自定义窗口标题.avi 所在项目:customtitle 63_PopupWindow.avi 所在项目:PopupWindow 64_ListView数据异步加载与AsyncTask.avi 所在项目:DataAsyncLoad 65_ListView数据的分批加载.avi 所在项目:datapageload...

    ZendFramework中文文档

    13.8. 自定义Feed和条目类 14. Zend_Filter 14.1. 简介 14.1.1. 什么是过滤器(filter)? 14.1.2. 过滤器的基本用法 14.1.3. 使用静态 get() 方法 14.2. 标准过滤器类 14.2.1. Alnum 14.2.2. Alpha 14.2.3. ...

    ASP.NET的网页代码模型及生命周期

    在创建了ASP.NET应用程序后,系统同样会默认创建一个Default.aspx页面,不同的是,多出了一个Default.aspx.designer.cs,用来初始化页面控件,一般不需要修改。 4.1.5 ASP.NET网站和ASP.NET应用程序的区别 在ASP.NET...

    Smarty中文手册 chm版

    8. Custom Functions [自定义函数] assign counter cycle debug eval fetch html_checkboxes html_image html_options html_radios html_select_date html_select_time html_table math mailto ...

    smarty手册.chm

    8. Custom Functions [自定义函数] assign counter cycle debug eval fetch html_checkboxes html_image html_options html_radios html_select_date html_select_time html_table math mailto ...

    ExtAspNet v2.2.1 (2009-4-1) 值得一看

    -修正不能动态修改AccordionPane属性Items的BUG。 +为Button, MenuButton, LinkButton, LinkButtonField增加ConfirmTarget。 -如果需要在父页面弹出确认对话框,需要设置ConfirmTarget="_parent"(类似Window...

    ExtAspNet_v2.3.2_dll

    -修正不能动态修改AccordionPane属性Items的BUG。 +为Button, MenuButton, LinkButton, LinkButtonField增加ConfirmTarget。 -如果需要在父页面弹出确认对话框,需要设置ConfirmTarget="_parent"(类似Window...

Global site tag (gtag.js) - Google Analytics