Upon all the research I could do on the Internet, it seems as though accessing a resource (.xml layout file, in my case), located in the /res/drawable folder to return as Drawable was as simple as calling this line:
Ruboto::R::drawable::stroke_bg
However, when I tried that, I received the following error:
could not coerce Fixnum to class android.graphics.drawable.Drawable
The line on my view is:
scroll_view :background => Ruboto::R::drawable::stroke_bg, :layout => { :width => :match_parent, height: 1000 }
What is it that I am missing to get the resource out of that folder?
Ruboto::R::drawable::stroke_bg
is not a Drawable, but an int
resource ID. You have to get the actual resource to use it as a Drawable. Change the background attribute to something like this:
background: resources.getDrawable(Ruboto::R::drawable::stroke_bg)
or
background: resources.getDrawable($package.R.drawable.stroke_bg)