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. Error in native method Picture.nativeCreateFromStream()

Hello all,

I'm having some trouble creating a Picture from an InputStream. I am
trying to do this:

        ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
        Picture pic = Picture.createFromStream(bis);

The problem also occurs when I try to use an InputStream returned by
ContentResolver.openInputStream(Uri):

        InputStream is = getContentResolver.openInputStream(mUri);
        Picture pic = Picture.createFromStream(is);

Picture.createFromStream(InputStream) invokes the native method
Picture.nativeCreateFromStream(InputStream, byte[]), and this is where
the trail goes cold for me:

    public static Picture createFromStream(InputStream stream) {
        return new Picture(
            nativeCreateFromStream(stream, new byte
[WORKING_STREAM_STORAGE]));
    }

I have been loading images from this Uri ("content://media/external/
images/media/152") successfully for a while. I open an InputStream,
read all the bytes, close the input stream, and there is no problem.
However, when I try to use either the InputStream returned by
ContentResolver.openInputStream(Uri), or I read all the bytes out of
that and wrap them in a ByteArrayInputStream, Picture.createFromStream
(InputStream) fails with the stack trace below.

Has anyone successfully used Picture.createFromStream(InputStream)?

======= Stack Trace ========
I/dalvikvm-heap( 4776): Grow heap (frag case) to 5.940MB for 3000016-
byte allocation
D/dalvikvm( 4776): GC freed 371 objects / 20736 bytes in 89ms
I/Image   ( 4776): Read 345682 bytes for 
content://media/external/images/media/152.
I/DEBUG   (   29): *** *** *** *** *** *** *** *** *** *** *** *** ***
*** *** ***
I/DEBUG   (   29): Build fingerprint: 'android-devphone1/
dream_devphone/dream/trout:1.0/UNLOCKED/116222:userdebug/test-keys'
I/DEBUG   (   29): pid: 4776, tid: 4776  >>> org.hopto.group18.postbot
<<<
I/DEBUG   (   29): signal 6 (SIGABRT), fault addr 000012a8
I/DEBUG   (   29):  r0 00000000  r1 00000006  r2 00000000  r3 00000080
I/DEBUG   (   29):  r4 00002eb0  r5 40008000  r6 00000000  r7 00000025
I/DEBUG   (   29):  r8 beb0a630  r9 4104d9c8  10 4104d9b8  fp 00000000
I/DEBUG   (   29):  ip ffffffff  sp beb0a5c8  lr afe0ef37  pc
afe0d1fc  cpsr 00000010
I/DEBUG   (   29):          #00  pc afe0d1fc  /system/lib/libc.so
I/DEBUG   (   29):          #01  pc afe0ef34  /system/lib/libc.so
I/DEBUG   (   29):          #02  pc ace08540  /system/lib/libcorecg.so
I/DEBUG   (   29):          #03  pc ac075cec  /system/lib/libsgl.so
I/DEBUG   (   29):          #04  pc ad3413da  /system/lib/
libandroid_runtime.so
I/DEBUG   (   29):          #05  pc ad00d9f4  /system/lib/libdvm.so
I/DEBUG   (   29):          #06  pc ad04120e  /system/lib/libdvm.so
I/DEBUG   (   29):          #07  pc ad012748  /system/lib/libdvm.so
I/DEBUG   (   29):          #08  pc ad02a92c  /system/lib/libdvm.so
I/DEBUG   (   29):          #09  pc ad0169d0  /system/lib/libdvm.so
I/DEBUG   (   29):          #10  pc ad052096  /system/lib/libdvm.so
I/DEBUG   (   29):          #11  pc ad03ccbc  /system/lib/libdvm.so
I/DEBUG   (   29):          #12  pc ad012748  /system/lib/libdvm.so
I/DEBUG   (   29):          #13  pc ad02a92c  /system/lib/libdvm.so
I/DEBUG   (   29):          #14  pc ad0169d0  /system/lib/libdvm.so
I/DEBUG   (   29):          #15  pc ad051f10  /system/lib/libdvm.so
I/DEBUG   (   29):          #16  pc ad03f87a  /system/lib/libdvm.so
I/DEBUG   (   29):          #17  pc ad3282b4  /system/lib/
libandroid_runtime.so
I/DEBUG   (   29):          #18  pc ad328d40  /system/lib/
libandroid_runtime.so
I/DEBUG   (   29):          #19  pc 00008c12  /system/bin/app_process
I/DEBUG   (   29):          #20  pc afe1dbd2  /system/lib/libc.so
I/DEBUG   (   29):          #21  pc afe0b010  /system/lib/libc.so
I/DEBUG   (   29):          #22  pc b0000d70  /system/bin/linker
I/DEBUG   (   29): stack:
I/DEBUG   (   29):     beb0a588  beb0a630  [stack]
I/DEBUG   (   29):     beb0a58c  afe35f3c
I/DEBUG   (   29):     beb0a590  00000084
I/DEBUG   (   29):     beb0a594  00000001
I/DEBUG   (   29):     beb0a598  afe35f3c
I/DEBUG   (   29):     beb0a59c  0000000c
I/DEBUG   (   29):     beb0a5a0  afe35f3c
I/DEBUG   (   29):     beb0a5a4  afe12dbd  /system/lib/libc.so
I/DEBUG   (   29):     beb0a5a8  afe35f3c
I/DEBUG   (   29):     beb0a5ac  afe35f90
I/DEBUG   (   29):     beb0a5b0  00000000
I/DEBUG   (   29):     beb0a5b4  afe1238d  /system/lib/libc.so
I/DEBUG   (   29):     beb0a5b8  ace0acc0  /system/lib/libcorecg.so
I/DEBUG   (   29):     beb0a5bc  afe11539  /system/lib/libc.so
I/DEBUG   (   29):     beb0a5c0  df002777
I/DEBUG   (   29):     beb0a5c4  e3a070ad
I/DEBUG   (   29): #00 beb0a5c8  00002eb0
I/DEBUG   (   29):     beb0a5cc  40008000
I/DEBUG   (   29):     beb0a5d0  00000000
I/DEBUG   (   29):     beb0a5d4  4104d9d0
I/DEBUG   (   29):     beb0a5d8  ffffffff
I/DEBUG   (   29):     beb0a5dc  afe0ef37  /system/lib/libc.so
I/DEBUG   (   29): #01 beb0a5e0  00000004
I/DEBUG   (   29):     beb0a5e4  00000001
I/DEBUG   (   29):     beb0a5e8  00000000
I/DEBUG   (   29):     beb0a5ec  10000000
I/DEBUG   (   29):     beb0a5f0  b000f55c  /system/bin/linker
I/DEBUG   (   29):     beb0a5f4  ffffffdf
I/DEBUG   (   29):     beb0a5f8  ac1261c4
I/DEBUG   (   29):     beb0a5fc  00065448  [heap]
I/DEBUG   (   29):     beb0a600  000bfa68  [heap]
I/DEBUG   (   29):     beb0a604  ace08544  /system/lib/libcorecg.so

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

2. Why Google chooses odd versions of Kernel tree ?

Hi All,

      Can anyone explain why Google chooses odd versions of Kernel
tree ?

       It is valid not to use the latest version for developments but
why always odd ones like 25 and 27.


rgds,
Gulshan
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: 

3. add listener to listview in dialog

4. Interesting and useful site 4u

5. XML Schemas for Android namespaces?

6. Need to display video from raw frame data

7. Would you like to let me know how to display a static text description for each Geopoint in OverlayItem?