Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27833] Android: Theme not applied to DrawerLayout leftView

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, drawerlayout, theme
ReporterMichael Gangolf
AssigneeAbir Mukherjee
Created2020-04-04T12:26:28.000+0000
Updated2020-04-07T01:14:38.000+0000

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

FileDateSize
Screenshot_20200404-142242.png2020-04-04T12:23:49.000+000032613
Screenshot_20200404-142305.png2020-04-04T12:23:49.000+000031541

Comments

No comments

JSON Source