0

我想隱藏操作欄。鈦:如果窗口背景具有不透明度,操作欄不會隱藏

在大多數情況下,按照這些說明,並創建一個自定義的主題似乎很好地工作:

http://docs.appcelerator.com/platform/latest/#!/guide/Android_Action_Bar-section-src-36735509_AndroidActionBar-HidingtheActionBar

我所做的是什麼:

1)增加了以下的自定義主題

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="Theme.NoActionBar" parent="@style/Theme.AppCompat"> 
     <item name="android:windowActionBar">false</item> 
     <item name="android:windowNoTitle">true</item> 
     <!-- AppCompat Compatibility --> 
     <item name="windowActionBar">false</item> 
     <item name="windowNoTitle">true</item> 
    </style> 
</resources> 

2)修改tiapp.xml

<android xmlns:android="http://schemas.android.com/apk/res/android"> 
    <manifest> 
     <application android:theme="@style/Theme.NoActionBar"/> 
    </manifest> 
</android> 

大多數情況下,標題不會顯示。但是,如果您有透明窗口,則可以再次看到標題欄。

例如,請考慮以下幾點:

父窗口

enter image description here

注意,這裏沒有行動起來吧

窗口沒有透明度

"#win": { 
    backgroundColor: "red", 
} 

enter image description here

注意,操作欄仍然不可見

窗口與一些透明度

"#win": { 
    backgroundColor: "red", 
    opacity: 0.5, 
} 

enter image description here

回答

3

鈦包括可以使用幾個預先定義的主題如果你只想隱藏操作欄。 http://docs.appcelerator.com/platform/latest/#!/guide/Android_Themes-section-src-34636181_AndroidThemes-TitaniumThemes

我認爲Theme.AppCompat.Translucent.NoTitleBarTheme.AppCompat.Translucent.NoTitleBar.Fullscreen對你都很有意思。

如果使用theme:屬性來指定這個在[controller].tss(或.xml的窗口屬性,你應該是金色的。

<Window theme="Theme.AppCompat.Translucent.NoTitleBar"> 
+0

這是完美的補充風格。但我怎樣才能讓它使所有的窗口使用該主題。我試着添加:''但這似乎沒有工作 –

+4

設置主題清單必須工作,但如果它不是我爲你的,那麼你可以這樣做** app.tss **: ''Window [platform = android]「:{theme:」Theme.AppCompat.Translucent.NoTitleBar.Fullscreen「}' –

0

就在tiapp.xml

<android 
    xmlns:android="http://schemas.android.com/apk/res/android"> 
    <manifest android:versionCode="16" android:versionName="4.1"> 
     <application android:theme="@style/Theme.AppCompat.Translucent.NoTitleBar.Fullscreen"> 
     <activity android:configChanges="keyboardHidden|orientation" android:grantUriPermissions="true" android:screenOrientation="portrait" android:textAllCaps="false"/> 
     </application> 
    </manifest> 
    </android> 
+0

Isn這與我已經有過的類似嗎? –

+0

這是默認的** **不需要爲隱藏操作欄創建custome主題 –