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主题 –