Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-27833

Android: Theme not applied to DrawerLayout leftView

    Details

      Description

      When using a custom theme to change the scrollbar layout it works for the centerView of DrawerLayout but not for the leftView:

      var win = Ti.UI.createWindow();
       
      var leftView = Ti.UI.createView({ backgroundColor:'red' });
      var centerView = Ti.UI.createView({ backgroundColor:'#000' });
       
      var drawer = Ti.UI.Android.createDrawerLayout({
          leftView: leftView,
          centerView: centerView
      });
       
      var tableData = [ {title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'},{title: 'text'} ];
      var table = Ti.UI.createTableView({ data: tableData});
      var table2 = Ti.UI.createTableView({ data: tableData});
      leftView.add(table);
      centerView.add(table2);
       
       
      win.addEventListener('open', function(){
          var activity = win.activity,
              actionBar = activity.actionBar;
       
          if (actionBar) {
              actionBar.displayHomeAsUp = true;
              actionBar.onHomeIconItemSelected = function() {
                  drawer.toggleLeft();
              };
          }
      });
       
      win.add(drawer);
      win.open();
      

      Theme (app/platform/android/res/values/mytheme.xml):

      <?xml version="1.0" encoding="utf-8"?>
      <resources>
      	<style name="Theme.MyTheme" parent="Theme.AppCompat">
      		<item name="android:scrollbarThumbVertical">@drawable/scroll_bar_vertical</item>
      	</style>
      </resources>
      

      Drawable (app/platform/android/res/drawable/scroll_bar_vertical.xml):

      <?xml version="1.0" encoding="utf-8"?>
      <shape xmlns:android="http://schemas.android.com/apk/res/android">
      	<size android:width="10dp"/>
      	<gradient android:angle="45" android:centerColor="#ff00FFff" android:endColor="#ffFD21ff" android:startColor="#ff00FFff"/>
      	<corners android:radius="2dp"/>
      </shape>
      

      set the theme in tiapp.xml

       <android
          xmlns:android="http://schemas.android.com/apk/res/android">
          <manifest
            xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1">
      	  <application android:theme="@style/Theme.MyTheme" />
          </manifest>
        </android>
      

      See attached screenshots: the leftView scrollbar should have the same style as the centerView scrollbar.

      Tested: 8.3.1.GA and 9.0.0.GA

        Attachments

          Activity

            People

            • Assignee:
              amukherjee Abir Mukherjee
              Reporter:
              michael Michael Gangolf
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration