2015-09-29 74 views
3

在styles.xml中,以我的用戶風格,我無法設置窗口標題大小(高度)。Android 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> 

不工作。

我該怎麼辦?

+0

能否請您發表您的'AndroidManifest.xml'文件? – Mauker

+0

請參閱*編輯*有問題的清單片段。 – theWalker

+0

my_style在沒有這一項的情況下正常工作:標題的大小。 Bkg,文字大小和顏色我可能會改變而沒有問題。 – theWalker

回答

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/> 
+0

這不是答案。我的自定義主題與沒有設置窗口標題大小的任何選項配合 – theWalker

+0

等等,什麼?你能澄清一下嗎? – Mauker