简体   繁体   中英

titanium android custom theme no window actionbar

I've an android app written using titanium sdk. the new sdk ( 3.5.0GA ) changed things about managing the default window title and actionbar behaviour.

the official blog offers 3 ways to solve this problem ( official doc ):

the first solution ( $.index.activity.actionBar.hide(); ) has a problem: the actionbar is shown for a while before being hidden. that animation is not what I want.

the second solution would be better if I can make it works ( customtheme.xml )

my situation is as follows:

tiapp.xml

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19"/>
    <manifest>
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
        <application android:theme="@style/MyTheme"/>
        <application android:hardwareAccelerated="true"/>
        <application android:largeHeap="true"/>
    </manifest>
</android>

/platform/android/res/values/customtheme.xml

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

the same thing done with a plain android studio project, does the magic.

actually, the error I got, is

[ERROR] :  /Users/dariorusignuolo/Desktop/titanium-cocktailsmachine/CM/build/android/AndroidManifest.xml:14: error: Error: No resource found that matches the given name (at 'theme' with value '@style/Theme.AppCompat.Translucent.NoTitleBar.Fullscreen').

it seems to me that the App compat library is missing (I have installed the android support library v 21.0.3 )

I don't know how to solve my problem. anybody knows?

ps. didn't try the third option, but just want to make the second one works. less code lines...

the solution to solve my problem was to (thanks to turle for the help):

in the platform/res/values/MyTheme.xml

<resources>
    <style name="MyTheme" parent="@style/Theme.AppCompat">
        <item name="android:windowNoTitle">true</item>
    </style>

</resources>

and to edit the manifest through the tiapp.xml this way

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <tool-api-level>14</tool-api-level>
    <manifest>
        <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14"/>
        <application android:theme="@style/MyTheme"/>
    </manifest> 
</android>

maybe you that encountered this problem should project -> clean to see the theme been applied

hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM