[TIMOB-28571] Android: Add "R.drawable" ID support to ActionBar icons
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2021-10-29T22:36:08.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 10.2.0 |
Components | Android |
Labels | ActionBar, android, icon, resource |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2021-10-27T22:17:56.000+0000 |
Updated | 2021-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();
PR (master): https://github.com/appcelerator/titanium_mobile/pull/13149