简体   繁体   中英

Android how to have transparent container with opaque elements

I'm using OSM Bonus Pack and osmdroid to develop a mapping app(recommended!), i've stumbled upon a problem when displaying the more_info windows.

I want to display an image, a title and a description and subdescription with the window background transparent.

The problem even though im defining the container(RelativeLayout) alpha to 0.8 and the elements alpha to 1.0, the containers are retaining the container transparency.

How do I keep the container with its alpha but keep the elements completely opaque?

Remain alpha of your container 1.0, just set its background transparent.

NOT:

<RelativeLayout 
     android:alpha="0.8"
     android:background="#fff"
    ...

BUT:

<RelativeLayout 
     android:alpha="1.0"
     android:background="#afff"
    ...

Why not just editing the bonuspack_bubble_black.9.png file with an image editor, and increase its transparency level? (taking care to respect the nine-patch borders, of course)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM