Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

How to use Android drawable xml in a Titanium Alloy project?

$
0
0

I'm using Titanium Studio 3.2.0 and Titanium SDK 3.2.0.GA, my OS is MacOSX and my deploy target is Android.

I want to use the Buy with Google drawable resource provided by Google into my project. I added it to my res folder in my project (ProjectRoot -> platform -> android -> res) and then I tried to add it to an ImageView like this:

var googleWalletButton = Ti.UI.createView({
        width : Ti.UI.FILL,
        height : '30dp',
        backgroundColor : 'red'
    });
 
    var googleWalletDrawable = Ti.UI.createImageView({
        image : Ti.App.Android.R.drawable.wallet_button_background
    });
    googleWalletButton.add(googleWalletDrawable);
    $.BuyCreditsWorkspace.add(googleWalletButton);
But the drawable isn't loading. I checked the documentation on Ti.App.Android.R and the documentation on ImageView, and while my access to the drawable is correctaccording to the Ti.App.Android.R documentation, it seems ImageView doesn't support drawables defined in a xml like this.

Is there a way to use drawable resources defined in xml, like the Buy with Google, in a Titanium project? How can I achieve this?


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>