| Fancy ListViews, Part Five |
|
|
|
|
In one of our
earlier posts in this Fancy ListViews series, Michal asked “could you make also
a short tutorial on changing the background image and text color of the selection
in Of course, we at AndroidGuys love fan mail! So, let’s talk about
changing the way selections look in In theory, changing the selection bar is a matter of setting
the Let’s first take a simple case: we want to change the color of the selection bar to something else, such as green. In the layout XML, the change is a single line:
All we did was add
That change alone will give us a That’s nice and all, but suppose we want to do something more elaborate, something more exciting, something that speaks to the way the world is today. In other words, rather than have list items be solely highlighted with a bar, we want to have them be pointed to by the Flying Fickle Finger of Fate. (NOTE: any resemblance of this Flying Fickle Finger of Fate to the original is purely coincidental and terribly amusing) For the Flying Fickle Finger of Fate (or FFFF for short), we’ll use a suitable icon, courtesy of OpenClipArt.org:
The goal is to have the currently-selected list entry be pointed to by the finger. Sounds easy, right? After all, since Right? Well, not exactly. Android will attempt to stretch whatever PNG drawable you use
as the list selector, so it takes up the full width of the I tried that and got…unpleasant results. Whether that was the result of my error in coding, my error in understanding how to make PNG-based list selectors work, or a bug in the M5 SDK, is still under investigation. But the Flying Fickle Finger of Fate will not be denied. So, let’s take a look at how you “manually” adjust the way selected items looks. This also covers Michal’s second request — to see how to adjust other properties of the selected row besides the background image. Working from the code first demonstrated in a previous post, let’s make a few changes. First, we add an
Note how we neglected to provide the Next, we update our
Next, we add an In
In
The result is almost what we were after, complete with the green bar discussed earlier:
There are two flaws in this implementation as seen in the M5
SDK emulator. First, we get a FFFF icon on the first row when the activity starts,
even though the row is not selected. That is because While this demo shows activating or deactivating an icon in the
row, you could do whatever you want to the View that makes up the row. So, if Michal
wanted to change the text color of the selected row, that’s merely a matter of getting
one’s hands on the desired Of course, Next time, in our final episode of the Fancy ListViews series,
we will go back to the checklist scenario from before and wrap up the checkable-row
logic into a
Source: http://androidguys.com/2008/07/28/fancy-listviews-part-five/
Set as favorite
Bookmark
Email This
Hits: 4066 Comments (11)
![]() birkenstock shoes
written by birkenstock , May 29, 2010 When you are on a holiday in some seaside resort where you will hike and walk on cliffs, Birckenstock is one of the brands to which you turn your attention to find some slippers or flip-flops that make a holiday in comfort and without pain in the feet after a romantic walk on the rocks.Birkenstocks is the well-known German footwear brand: Birkenstock shoes, Birkenstock sandals and Birkenstock clogs.Birkenstock Gizeh is a flattering flip-flop style with a leather upper that will look great with shorts, jeans or dresses, at the same time, it has an irresistible air between the tourist and hiking, and you can be sure that the evening will have no pain, given the high quality these shoes.
report abuse
vote down
vote up
Votes: +0
...
written by supra shoes , May 31, 2010 The are popular with both recreation and Supra Shoes
Supra Footwear sportswear are simply matchless in terms of style, comfort and longevity, Now! Free Shipping! NO Tax! report abuse
vote down
vote up
Votes: +0
air max 2009
written by air max 2009 , May 31, 2010 are you looking for a air max 2009?
here are not only offer the nike free shoes ,but aslo for thenew lebron VII shoes report abuse
vote down
vote up
Votes: +0
...
written by mbt , June 18, 2010 The are popular with both recreation
report abuse
vote down
vote up
Votes: +0
changing the selection...
written by coach outlet store online , June 19, 2010 changing the selection bar is a matter of setting the android:listSelector property on the ListView widget in the layout XML, or using the equivalent setSelector() methods
report abuse
vote down
vote up
Votes: +0
Cheap San Francisco 49ers Jerseys
written by sexy bikinis , June 24, 2010 It is not the NFL Jerseys critic who counts,not the man who points out how the strong man stumbles,the doer of deeds could have sexy bikinis sale done them better. The credit belongs to the man who is actually in the arens,whose face is marred by dust and sweat and blood.
report abuse
vote down
vote up
Votes: +0
mbt
written by mbt shoes , June 29, 2010 The credit belongs to the man who is actually in the arens,whose face is marred by dust and sweat and blood.
ugg boots report abuse
vote down
vote up
Votes: +0
...
written by sexy shoes , July 08, 2010 Ai jiangshan,gengai meinv,christian louboutin
christian louboutin shoes ,you can buy here on our shop . report abuse
vote down
vote up
Votes: +0
Cheap GHDs
written by Cheap GHDs , July 17, 2010 Cheap ghds is is provided purely as an information based service.
Cheap GHDs We provide information, specification, and price comparisons of ghd products, both promoting them and helping you find the best online prices from reputable retailers bringing you the cheapest ghds online. GHD Straighteners We try to ensure that information on this website is as accurate as possible, GHD Colour Collection however we accept no responsibility for any errors on this website whatsoever. This website is updated throughout the day, GHD IV Styler every day to ensure that the information you see is as accurate as possible. GHD Precious Gift Set This site is in no way owned by or affiliated with ghd and is an unofficial ghd price comparison website. GHD IV Styler Dark All images, logos and trademarks belong to their respective owners. GHD Radiance Benefit Set By using this website you are agreeing to our Privacy policy and Terms & Conditions. GHD Hair Straightener GHD on sale GHD IV Salon Styler GHD IV Mini Styler GHD IV Gold Styler GHD Kiss IV Styler GHD Pure IV Styler GHD Purple IV Styler GHD Black IV Styler GHD Benefit Styler GHD Rare Styler GHD Pink Styler report abuse
vote down
vote up
Votes: +0
Monster Energy Hats
written by Monster Energy Hats , July 28, 2010 I don’t know what to say except that I have enjoyed
reading.Nice blog,I will keep visiting this blog very often. report abuse
vote down
vote up
Votes: +0
... written by Abercrombie and fitch , July 29, 2010 http://whyandroid.com/android/...pters.html
report abuse
vote down
vote up
Votes: +0
Write comment
|