Android styles.xml窗口标题

3
在styles.xml中,我无法在用户的样式中设置窗口标题大小(高度)。

enter image description here

这总是一样的。

<item name="android:windowTitleSize">20dip</item>

并且

<style name="my_menu" parent="@android:style/Theme.Dialog">
    <item name="android:windowTitleStyle">@style/CustomMenuTitle</item>
    ...
<style/>

<style name="CustomMenuTitle" >
    <item name="android:layout_height">12dip</item>
    <item name="android:windowTitleSize">12dip</item>
<style/>

* 编辑 *

in manifest.xml:

<activity android:name=".DlgSubmenuZnajdz"
          android:screenOrientation="sensor"
          android:configChanges="orientation|keyboardHidden"
          android:theme="@style/my_menu">
</activity>

不工作。

我该怎么做?


请问您能否发布您的 AndroidManifest.xml 文件? - Mauker
请在问题的清单片段中查看EDIT - theWalker
我的样式正常工作,只有一个问题:标题的大小。背景、文本大小和颜色我可以随意更改,没有问题。 - theWalker
试试我的修改,看看是否有效。 - Mauker
无法更改窗口标题大小。相同。 - theWalker
请确保您使用的是常规标题栏,而不是操作栏。 - user9599745
1个回答

0

如果您设置了自定义样式,您还需要修改您的AndroidManifest.xml文件。

类似于:

<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/my_menu">

您还可以将自定义主题应用于特定的Activity。就像下面的示例一样。

<activity android:name="com.example.Activity" android:theme="@style/my_menu">

编辑:尝试以下 xml:

<style name="my_menu" parent="@android:style/Theme.Dialog">
    <item name="android:layout_height">12dip</item>
    <item name="android:windowTitleSize">12dip</item>
    <item name="android:windowTitleStyle">@style/CustomMenuTitle</item>
    ...
<style/>

<style name="CustomMenuTitle" >
    <!-- customize other stuff here, like the example below -->
    <item name="android:textSize">20dip</item>
<style/>

这不是答案。我的自定义主题可以与任何选项一起使用,无需设置窗口标题大小。 - theWalker
1
等等,什么?你能否请澄清一下? - Mauker

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接