Android的 - 让使用该设备的当前主题标题栏自定义标题栏 [英] Android - Make a custom titlebar that uses the device's current titlebar theme

查看:234
本文介绍了Android的 - 让使用该设备的当前主题标题栏自定义标题栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使自定义标题栏我的第一个Android应用程序。

I'm trying to make a custom titlebar for my first Android application.

虽然我可以找到很多关于如何让他们这样你就可以改变颜色等在网络上,我希望我的标题栏看起来一样的标准标题栏,但有一个按钮,我可以配置。这意味着复制设备的当前活动的主题,以便能够样式它以完全相同的方式

While I can find lots on the web about how to make them so you can change colours etc, I want my titlebar to look the same as the "standard" titlebar, but with a button that I can configure. This means copying the device's currently active themes to be able to style it in exactly the same way.

不是所有的设备只需使用一个渐变的标题栏风格,所以添加一个梯度(如在其他SO问题的建议)并没有真正意义。

Not all devices simply use a gradient in the titlebar style, so adding a gradient (as suggested in other SO questions) doesn't really make sense.

有没有人有任何指针如何读取样式信息?

Does anyone have any pointers how to read the style information?

推荐答案

尝试例如延长现有主题
创建自己的风格,可以ofcourse从现有主题现有延伸。改变windowNoTitle为true。

try to extend an existing theme e.g. create your own style which can ofcourse extend from existing from an existing theme. change the windowNoTitle to true.

  <?xml version="1.0" encoding="utf-8"?>
  <resources>
  <style name="noTitleBarStyle" parent="android:Theme.Black">
  <item name="android:windowNoTitle">true</item>
  <item name="android:windowBackground">@color/darkGrey</item>   
  <item name="android:colorForeground">#ff3333</item> 
  </style></resources>

或尝试做运行时为这里讨论
<一href=\"http://stackoverflow.com/questions/820398/android-change-custom-title-view-at-run-time\">Android - 在运行时更改自定义标题视图

or try to do it runtime as discussed here Android - change custom title view at run time

我希望这有助于。

这篇关于Android的 - 让使用该设备的当前主题标题栏自定义标题栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆