Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28571] Android: Add "R.drawable" ID support to ActionBar icons

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2021-10-29T22:36:08.000+0000
Affected Version/sn/a
Fix Version/sRelease 10.2.0
ComponentsAndroid
LabelsActionBar, android, icon, resource
ReporterJoshua Quick
AssigneeJoshua Quick
Created2021-10-27T22:17:56.000+0000
Updated2021-10-29T22:36:11.000+0000

Description

*Summary:* [Ti.Android.ActionBar](https://titaniumsdk.com/api/titanium/android/actionbar.html) properties "icon" and "logo" currently only support a String path to an image. It should be modified to support Ti.App.Android.R.drawable IDs so that it can be assigned a vector drawable, which are commonly used as icons in native Android apps. *Icon Example:*
const window = Ti.UI.createWindow();
window.activity.onCreate = () => {
	const actionBar = window.activity.actionBar;
	actionBar.icon = Ti.App.Android.R.drawable.titanium_icon_checkcircle;
};
window.open();
*Logo Example:* Note that you would normally use a PNG for a logo, but vector drawables should be allowed too.
const window = Ti.UI.createWindow();
window.activity.onCreate = () => {
	const actionBar = window.activity.actionBar;
	actionBar.logo = Ti.App.Android.R.drawable.titanium_icon_checkcircle;
};
window.open();

Comments

  1. Joshua Quick 2021-10-28

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/13149

JSON Source