2016年1月10日 星期日

Customise Android ActionBar

ActionBar style generator
http://jgilfelt.github.io/android-actionbarstylegenerator/

Theoretical steps BUT not work for my appcelerator project
Ref: appcelerator
1. create resource files using ActionBar Style Generator
2. download generated .zip file and put in project /platform/android/res folder
3. modify tiapp.xml to use generated style.
<manifest>
     <application android:theme="@style/Theme.Actionbar"/>
</mainfest>

Workaround solution to change ActionBar background color:
1. use ActionBar Style Generator to create resource files.
2. copy desired background .9.png to project folder
3. use ActionBar.setBackgroundImage() and refer to the .9.png


Hide/Show action bar for certain window

1. create /platform/android/res/values/customtheme.xml
<?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. when create window, set theme:
var w=Ti.UI.createWindow({
        backgroundColor: "red",
        theme: "Theme. NoActionBar" // this is only available starting on 3.3.1
});

Ref: http://www.appcelerator.com/blog/2014/08/hiding-the-android-actionbar/



沒有留言:

張貼留言