自定义的title无法填充完全
2014-08-14 08:33
120 查看
昨天有遇到这个问题,很头疼,用了很多方法都没解决。其实很简单:
注意哦,在style.xml里面一点要有:
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub setTheme(R.style.CustomTheme); //使用自定义的title样式 super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); //使用自定义的title setContentView(R.layout.setting_common); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_main2); //注意:::上面三行一定不能打乱顺序!!!! initTitle(); } private void initTitle() { // TODO Auto-generated method stub ((TextView)this.findViewById(R.id.titlemain_tv_title2)).setText( "关于我们"); ((ImageView)this.findViewById(R.id.titlemain_iv_titleback2)).setOnClickListener(this); TextView tv_cancel = (TextView)this.findViewById(R.id.titlemain_tv_titleright2); tv_cancel.setText("完成"); tv_cancel.setOnClickListener(this); }
注意哦,在style.xml里面一点要有:
<style name="CustomTheme" parent="android:Theme"> <item name="android:windowTitleSize">60dip</item> <item name="android:padding">0sp</item> <!-- 使自定义的title完全填充 --> </style>
<span style="color:#ff0000;"> <item name="android:padding">0sp</item> <!-- 使自定义的title完全填充 --></span>
相关文章推荐
- [iOS]技巧集锦:UITableView自定义Cell中的控件无法完全对齐Cell的左边界和右边界
- 安卓开发 自定义Dialog的问题总结之---Title背景为黑问题、edittext无法弹出软键盘
- Android添加新版本支持包V7后自定义ActionBar左侧有空白,不能完全填充问题解决
- Android 自定义Title 设置背景填充不满解决方案
- android新版本support包V7后自定义actionbar左边有一块空白无法填充
- app图标有黑边(无法完全填充)的问题
- ActionBar 使用自定义view 宽度填充不完全的解决方法
- 最近自定义Toolbar之后,左侧不能完全填充,总是留一点空白问题
- 自定义控制title提示框
- 完全无法集中精力
- [原创]Tsys 2.0 beta 官方版无法使用自定义SQ
- 自定义Title
- Enjoy! 多达400多万的动态搞笑,爱情,友情。。。。表情下载 表情表情自定义表情表情图片下载 自定义QQ表情使用方法完全图解
- OllyDbg完全教程 自定义函数描述[Custom function descriptions]
- JS+DIV实现自定义Title的显示方式
- 自定义Title
- windows下tomcat无法完全undeploy的问题
- 一次性为自定义实体类的数据填充
- 解决WINCE500中INTEL编译器无法完全卸载的问题
- 自定义图片填充工作流外观