Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Android
variable in xml layout
simone giusti
Ranch Hand
Posts: 55
posted 7 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hello,
I need to change background color in listview item, based on a variable value.
<TextView android:id="@+id/CueName" android:layout_width="300dp" android:layout_height="wrap_content" android:lines="1" android:maxLines="1" android:paddingLeft="3dp" android:background="@MYVALUE" />
How can ho do that ?
I have an hashmap reporting CUENAME and BACKGROUNDCOLOR (@myvalue)
Darryl A. J. Staflund
Ranch Hand
Posts: 314
2
I like...
posted 7 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi there,
If the variable is going to take on different values at runtime, then I think you'll have to change your background programmatically using something like the following:
... View v = mRootView.findViewById(R.id.ofViewInQuestion); v.setBackground(R.drawable.drawableId); v.setBackgroundColor(R.color.colorId); v.setBackgroundResource(getResource().getColor(R.color.colorId)); ... ...etc... ...
Hope this helps.
Darryl
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Need Help on the scrolling Bar in Android?
ScrollView issue in my layout
Activity content overlapping TabView
How to show a title to a ListView
Please, explain me how can I edit item of an arraylist
More...