Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13427] Android: Expose TabGroup title properly when using the ActionBar

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusReopened
ResolutionUnresolved
Affected Version/sRelease 8.1.0, Release 8.3.0
Fix Version/s2013 Sprint 25, 2013 Sprint 25 API, Release 3.3.0
ComponentsAndroid
Labelsmodule_tabgroup, qe-testadded, triage
ReporterIgor Santos
AssigneeBiju pm
Created2012-12-13T00:09:56.000+0000
Updated2019-11-07T15:18:06.000+0000

Description

As Arthur Evans said: {quote} I think there are two competing schools of though here (at least): 1) We should expose a title on the tab group. 2) The action bar title should take the title of the current tab's window. I've spent some time reviewing the Android docs, and it's not clear to me which of these is preferable. {quote} IMHO, if the tab already has a title, it's quite pointless to repeat this title in the ActionBar. In my application I'm using tabs to split the content of a shopping list between the items and the values... one tab is called "products", the other is "summary", and the actionBar title would be the list's name. I've attached a screenshot as an example. *Bottom line*: Maybe the TabGroup could use the provided title property, and when it's not present, use the active tab title?

Attachments

FileDateSize
Seleção_125.png2012-12-13T00:09:56.000+00007344

Comments

  1. Joucke Hempenius 2013-04-23

    Any news on this? Currently my tabgroup ActionBar titles are empty :/
  2. Biju pm 2013-11-06

    Test case
        var win1 = Ti.UI.createWindow({
           title: 'Win 1'
       });
         
       var tab1 = Ti.UI.createTab({  
           title: 'PRODUCTS',
         
       });
         
       var win2 = Ti.UI.createWindow({
           title: 'Win 2'
       });
         
       var tab2 = Ti.UI.createTab({  
           title: 'List SUMMARY',
           window: win2
       });
        
       var tabGroup = Ti.UI.createTabGroup({
           title: 'Group Test',
            
       });
              
       tabGroup.addTab(tab1);
       tabGroup.addTab(tab2);
         
       tabGroup.open();
       
  3. Biju pm 2013-11-06

    PR :- https://github.com/appcelerator/titanium_mobile/pull/4920
  4. Ping Wang 2013-12-02

    Another test case for changing the tab group's title:
       var win1 = Ti.UI.createWindow({
           title: 'Win 1'
       });
          
       var tab1 = Ti.UI.createTab({  
           title: 'PRODUCTS',
          	window: win1
       });
          
       var win2 = Ti.UI.createWindow({
           title: 'Win 2'
       });
          
       var tab2 = Ti.UI.createTab({  
           title: 'List SUMMARY',
           window: win2
       });
         
       var tabGroup = Ti.UI.createTabGroup({
           title: 'Group Test',
             
       });
       
       var b1 = Ti.UI.createButton({
       	top: 10,
       	title: "tabGroup.title = 'title changed'"
       });
       b1.addEventListener("click", function(){
       	tabGroup.title = "title changed";
       	alert("tabGroup.title = " + tabGroup.title);
       });
       win1.add(b1);
       
       var b2 = Ti.UI.createButton({
       	top: 110,
       	title: "tabGroup.setTitle('title reset')"
       });
       b2.addEventListener("click", function(){
       	tabGroup.setTitle("title reset");
       	alert("tabGroup.getTitle() = " + tabGroup.getTitle());
       });
       win1.add(b2);
       
       tabGroup.addTab(tab1);
       tabGroup.addTab(tab2);
          
       tabGroup.open();
       
    Run the above test case with
       <android xmlns:android="http://schemas.android.com/apk/res/android">
           <manifest>
               <uses-sdk android:targetSdkVersion="10"/>
           </manifest>
       </android>
       
    and with
       <android xmlns:android="http://schemas.android.com/apk/res/android">
           <manifest>
               <uses-sdk android:targetSdkVersion="11"/>
           </manifest>
       </android>
       
  5. Samir Mohammed 2019-11-07

    setTitle no longer changes the tab group title. With the test case below note that the second button does not change the tabGroup title. *Test Case:*
       var win1 = Ti.UI.createWindow({
           title: 'Win 1'
       });
       
       var tab1 = Ti.UI.createTab({
           title: 'PRODUCTS',
           window: win1
       });
       
       var win2 = Ti.UI.createWindow({
           title: 'Win 2'
       });
       
       var tab2 = Ti.UI.createTab({
           title: 'List SUMMARY',
           window: win2
       });
       
       var tabGroup = Ti.UI.createTabGroup({
           title: 'Group Test',
       
       });
       
       var b1 = Ti.UI.createButton({
           top: 10,
           title: "tabGroup.title = 'title changed'"
       });
       b1.addEventListener("click", function(){
           tabGroup.title = "title changed";
           alert("tabGroup.title = " + tabGroup.title);
       });
       win1.add(b1);
       
       var b2 = Ti.UI.createButton({
           top: 110,
           title: "tabGroup.setTitle('title reset')"
       });
       b2.addEventListener("click", function(){
           tabGroup.setTitle("title reset");
           alert("tabGroup.getTitle() = " + tabGroup.getTitle());
       });
       win1.add(b2);
       
       tabGroup.addTab(tab1);
       tabGroup.addTab(tab2);
       
       tabGroup.open();
       
       
    *Test Environment*
       MacOS Catalina 10.15.1 Beta
       Node.js 10.16.3
       Google Pixel Emulator7.1.1
       {"NPM":"4.2.15-1","CLI":"7.1.1"}
       SDK 8.3.0.v20191030085531
       SDK 8.2.1.GA
       

JSON Source