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. Layout margin left/right issue in 2.2?

I'm using a framelayout to position 2 buttons in the center of the
screen.  I'm anchoring from the center (using layout gravity =
center_horizontal) then applying Layout margin left = 50dip and Layout
margin right = 50dip to each button.  In 2.2 the margins are being
drawn much larger than the numbers I've declared (50dip/50dip).  It
looks more like 125 or 150.  Oddly enough, this doesn't appear to be
happening with margin bottom/top, only left/right.  Is this a bug, or
a sign that I'm doing something incorrectly?

-- 

2. Accessing Common methods among activities

hi guys,

i have Activity A and Activity B

i want to access a method in Activity A from Activity B

this is my method
Activity A extends activity{

   public void save(){

   }
}

this is what i have done from activity B

Activity B extends activity{

   public void access{

                AcitvityA noti = (AcitvityA) getApplicationContext();
                noti.save();

   }

}

and i'm getting a runtime exception saying

java.lang.ClassCastException: android.app.Application


how can i access this method from another activity??

regards,
Mike

-- 

3. Pick a telephone number

4. onKeyDown not being called in TabActivity

5. HttpURLConnection and data roaming

6. calling servlet from android application

7. bluetooth erratic behavior