Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1517] Property displayHomeAsUp in menu/actionbar not working when set in alloy xml

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2014-09-01T06:53:00.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterAslan
AssigneeMauro Parra-Miranda
Created2014-07-14T08:28:55.000+0000
Updated2016-03-08T07:37:58.000+0000

Description

ActionBar allows to set home button as UP - it works as it should when setDisplayHomeAsUp is invoked, however when property displayHomeAsUp is set within xml it's not working at all:
<Alloy>
	
	<Window id="main" class="container">
		
		<Menu id="menu" platform="android" displayHomeAsUp="true">
			<MenuItem id="menu1" class="action" onClick="doClickMenu" />
			<MenuItem id="menu2" class="action" onClick="doClickMenu" />
			<MenuItem id="menu3" class="overflow" onClick="doClickMenu" />
		</Menu>
		
		<Label>Action Buttons</Label>
	
	</Window>
	
</Alloy>

Comments

  1. Amimul Hossain 2014-07-16

    Hi, We have tested this project with test code bellow and it's working in Ti SDK 3.3.0-RC.

    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

    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 "http://schemas.android.com/apk/res/android"/>" with the "tiapp.xml" 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 message "Home icon clicked"

    EXPECTED RESULT

    Home button should display and works as a one level up button

    Actual STATUS

    It's working

    TEST CODES

    index.js

       
       $.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();
       
       

    index.xml

       
          <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>
       
       

    alloy.js

       
       if( OS_ANDROID ) {
           Alloy.Globals.Android = { 
               "Api" : Ti.Platform.Android.API_LEVEL
           };
       }
       
       

    tiapp.xml

       
       <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>
       
       
    Thanks
  2. Mauro Parra-Miranda 2014-08-10

    Hello [~aslan]! Can you please take a look to this with the testcase above, 3.3.0.GA and let us know if it's failing for you? TIA!
  3. Mauro Parra-Miranda 2014-09-01

    Tested in 3.3.0.GA and works fine. Please test and if you still have an issue, please make a comment and provide a testcase that reproduces the issue in 3.3.0.GA.

JSON Source