Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5471] Android DrawerLayout getCenterView method is not working

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionInvalid
Resolution Date2017-12-30T22:20:47.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterMohamad Alhajj
AssigneeShak Hossain
Created2017-12-25T09:12:08.000+0000
Updated2017-12-30T22:20:48.000+0000

Description

The returned error when getCenterView is used is as follows: *getCenterView is not a function* Titanium version: 6.3.0.GA

Attachments

FileDateSize
getCenterViewAndroidDrawerLayout.zip2017-12-28T16:08:19.000+00009426056

Comments

  1. Mostafizur Rahman 2017-12-26

    Hello [~malhajj], Thanks for sharing with us. Please create a full reproducible test code and provide here for us to test the issue. Also, provide detail affected environment. Thanks.
  2. Mohamad Alhajj 2017-12-28

    Hello Mostafizur, I've updated the Environment field with the details about the affected environment and attached a test scenario. Regards
  3. Sharif AbuDarda 2017-12-28

    Hello, Why are you calling "androidDrawer.centerView" and "androidDrawer.getCenterView()" in console log? You already create them in drawer creation. "androidDrawer.getCenterView()" is when you don't define the certerview in drawer creation and you assign to it in drawer by the event listener. Something like below.
       var win = Ti.UI.createWindow();
       
       var leftView = Ti.UI.createView({ backgroundColor:'red' });
       var centerView = Ti.UI.createView({ backgroundColor:'yellow' });
       var rightView = Ti.UI.createView({ backgroundColor:'orange' });
       
       var drawer = Ti.UI.Android.createDrawerLayout({
           leftView: leftView,
           rightView: rightView
       });
       var btn = Ti.UI.createButton({ title: 'RIGHT' });
       
       btn.addEventListener('click', function() {
           drawer.toggleRight();
       });
       
       centerView.add(btn);
       
       win.addEventListener('open', function(){
           var activity = win.getActivity(),
               actionBar = activity.getActionBar();
           
       	drawer.getCenterView(centerView);
           if (actionBar) {
               actionBar.displayHomeAsUp = true;
               actionBar.onHomeIconItemSelected = function() {
                   drawer.toggleLeft();
               };
           }
       });
       
       win.add(drawer);
       win.open();
       
    This issue is invalid. Thanks.

JSON Source