开发者

How to put semi transparent buttons over an image in layout?

开发者 https://www.devze.com 2023-03-13 22:45 出处:网络
What I am trying to do is put few buttons, made from PNG image, that has opa开发者_运维技巧que border and semi transparent other area, over an image that will be controlled (zoomed, panned).

What I am trying to do is put few buttons, made from PNG image, that has opa开发者_运维技巧que border and semi transparent other area, over an image that will be controlled (zoomed, panned).

Something like that:

How to put semi transparent buttons over an image in layout?

What is the best way to achieve this? What layout and what views should be used? Maybe there is similar tutorial to such app design.


I guess I'd use a relative layout and skinned buttons. The only issue you'll have with skinned buttons is that you'll need to be sure you are using 32bit pngs (with a transparency layer) as your button skins.

Here's a code chunk for doing button skins - they get set as the background of the button object and you place them in the drawable folder along side your images.

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true"
      android:drawable="@drawable/btn_back_down" /> <!-- pressed -->
    <!-- item android:state_focused="true"
      android:drawable="@drawable/button_focused" /--> <!-- focused -->
    <item android:drawable="@drawable/btn_back_up" /> <!-- default -->
</selector>
0

精彩评论

暂无评论...
验证码 换一张
取 消