Creating semi-transparent list items - possible?

by mastix mc » Tue, 09 Jun 2009 01:19:22 GMT


Sponsored Links
 Hey guys,

I a newb when it comes to android but I quite a professional in
Java, though. :)

I planning a little demo app to learn all about android api
Ie already created a ListActivity which has a specific background.
What I would like to have now, is that the list items have a
transparency (like having an opacity of 75-80%) so that the background
shines through a little.

Could you guys tell me whether that possible?

Thank you very much in advance
mastix

--~--~---------~--~----~------------~-------~--~----~



Creating semi-transparent list items - possible?

by Mark Murphy » Tue, 09 Jun 2009 01:52:53 GMT


 


Yes, though you will need to specify your own custom row layout that has
the transparency you seek.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android Development Wiki:  http://wiki.andmob.org 

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Creating semi-transparent list items - possible?

by mastix mc » Tue, 09 Jun 2009 02:14:09 GMT


 Hi Mark,

thanks for that hint. :)

Do you have a demo/example/documentation that shows me what I have to
do?

Sascha





--~--~---------~--~----~------------~-------~--~----~



Creating semi-transparent list items - possible?

by Mark Murphy » Tue, 09 Jun 2009 02:19:31 GMT


 


Well, you only asked if it was possible, not how to actually *do* it... ;-)


1. Create a layout for your rows. Make sure your containers
(LinearLayout, etc.) have android:background set with an appropriate
transparency (e.g., "#80FF0000" is red with 50% transparency).

2. Specify that layout when you create your adapter. This could be as
simply as providing the layout ID in the adapter constructor, all the
way to implementing getView() (or newView()/bindView() for
CursorAdapter), depending on what you want to do with your rows.

For the getView() scenario, visit:

 http://wiki.andmob.org/samplecode 

where you will find links to the half-dozen or so blog posts I made
under the Fancy ListViews series.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android App Developer Books:  http://commonsware.com/books.html 

--~--~---------~--~----~------------~-------~--~----~



Creating semi-transparent list items - possible?

by mastix mc » Tue, 09 Jun 2009 03:32:07 GMT


 Hi Mark,

I haven't tried it yet, but I guess I can say that you're my hero! :)

thank you very much!

Thanks,

Sascha





--~--~---------~--~----~------------~-------~--~----~



Creating semi-transparent list items - possible?

by ayush » Tue, 09 Jun 2009 12:18:17 GMT


 if you want a traditional dialog-box look, then another option would
be to implement the built in Dialog Theme on your Activity containing
the ListView. also, you can override the standard Dialog Theme and
make changes to the background colour, fonts etc.
theres a short-and-sweet example on how to do this in the Android
Documentation under the section on User Interfaces => Applying Styles
and Themes. apart from the Dialog Theme you also have a Translucent
Theme. however, based on discussion forums, it seems that the
Translucent Theme cant be overridden and customized.







--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Space character in URI

I need to incorporate a space character in a URI but android
automagicaly converts spaces into URL encoding (i.e. %20).  how can I
prevent this or encode  a link to the URI so that it is converted into
' ' not '%20'?

example:
i want - content://my app
don't want - content://my%20app

i know this sounds absurd but I need it to work this way.

any thoughts?
--~--~---------~--~----~------------~-------~--~----~

2. Is there any chm format document of android?

I wonder if there is a chm-format help document of android.
Can I find it somewhere or anyone send me one. Thank you in advance!

Tagore
--~--~---------~--~----~------------~-------~--~----~

3. Spinner focus problem

4. Vertical scrolling inside text view

5. Get that money

6. Bluetooth Emulation

7. Problem complex types with ksoap Library for Soap webservice