Groups
Groups
Sign in
Groups
Groups
clojure-android
Conversations
About
Send feedback
Help
Problems using Background Gradient in RelativeLayout
21 views
Skip to first unread message
Pete Doherty
unread,
Mar 28, 2015, 4:49:15 AM
3/28/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to clojure...@googlegroups.com
Hi everyone,
How would I set a RelativeLayout's background using a gradient defined in an XML file?
I'm attempting to use:
```
[:relative-layout {
:background org.stuff.events.R$drawable/bg_gradient
}]
```
However, that results in the following error: `Couldn't find method .setBackground for argument int`
Alexander Yakushev
unread,
Mar 28, 2015, 4:54:44 AM
3/28/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to clojure...@googlegroups.com
http://developer.android.com/reference/android/view/View.html#setBackgroundResource(int)
android:background maps into setBackgroundResource(int) method. There is no :background trait in Neko, so the UI tree compiler falls back to making a setter from a property, which in your example becomes setBackground. So you should write:
[:relative-layout {:background-resource org.stuff.events.R$drawable/bg_gradient}]
Pete Doherty
unread,
Mar 30, 2015, 1:36:47 PM
3/30/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to clojure...@googlegroups.com
OK - that makes sense.
Thanks, Alexander!
Reply all
Reply to author
Forward
0 new messages