Created
July 16, 2014 07:26
-
-
Save Amimul100/fc9d426cb3382312d2b8 to your computer and use it in GitHub Desktop.
Property displayHomeAsUp in menu/actionbar not working when set in alloy xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Hi, we have tested this project, and it's working. | |
h5. TESTING ENVIRONMENT: | |
Ti CLI 3.3.0-rc | |
Titanium SDK: 3.3.0.RC and 3.2.X.GA | |
Min SdkVersion="10", Target SdkVersion="14" | |
Android Device and Emulator | |
h5. STEPS TO TEST | |
1. Create a new alloy project. | |
2. Copy and paste the "index.js" code segment given below to the project "index.js" file. | |
3. Copy and paste the "index.xml" code segment given below to the project "index.xml" file. | |
4. Copy and paste the "alloy.js" code segment given below to the project "alloy.js" file. | |
5. In the project tiapp.xml file replace "<android xmlns:android="http://schemas.android.com/apk/res/android"/>" with the "tiapp.xlm" code segment given below. | |
6. Run the project in android emulator or device. | |
7. Home button is showing an up arrow on it's left. | |
8. Click the home button to see <Alert> "Home icon clicked" | |
h5. EXPECTED RESULT | |
Home button should display and works as a one level up button | |
h5. STATUS | |
It's fully working | |
Thanks | |
*/ | |
h5. TEST CODES | |
h4. index.js | |
{code} | |
$.tabGroup.addEventListener('open', function(e) { | |
var activity = $.tabGroup.activity; | |
if( Alloy.Globals.Android.Api >= 11 ) { | |
activity.actionBar.title = "DemoApp"; | |
activity.actionBar.displayHomeAsUp = true; | |
activity.actionBar.onHomeIconItemSelected = function() { | |
alert("Home icon clicked!"); | |
}; | |
} | |
}); | |
$.tabGroup.open(); | |
{code} | |
h4. index.xml | |
{code} | |
<Alloy> | |
<TabGroup id="tabGroup" backgroundColor="white" > | |
<Tab id="tab1" title="Tab 1" icon="KS_nav_views.png"> | |
<Window id="win1" title="Tab 1"> | |
<Label id="label1" color="#999">I am Window 1</Label> | |
</Window> | |
</Tab> | |
<Tab id="tab2" title="Tab 2" icon="KS_nav_views.png"> | |
<Window id="win2" title="Tab 2"> | |
<Label id="label2" color="#999">I am Window 2</Label> | |
</Window> | |
</Tab> | |
<!-- Use the Require tag to include external Ti.UI.Tab views --> | |
</TabGroup> | |
</Alloy> | |
{code} | |
h4. alloy.js | |
{code} | |
if( OS_ANDROID ) { | |
Alloy.Globals.Android = { | |
"Api" : Ti.Platform.Android.API_LEVEL | |
}; | |
} | |
{code} | |
h4. tiapp.xml | |
{code} | |
<property name="ti.android.fastdev" type="bool">false</property> | |
<android xmlns:android="http://schemas.android.com/apk/res/android"> | |
<tool-api-level>14</tool-api-level> | |
<manifest> | |
<supports-screens android:anyDensity="false"/> | |
<uses-sdk android:maxSdkVersion="17" | |
android:minSdkVersion="10" android:targetSdkVersion="14"/> | |
</manifest> | |
</android> | |
{code} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment