Transparent layer over a text on a button on an Android

I have a big button with a text in a one layer, and I would like to create a semi-transparent white layout under or over that text (cuz button will have a background picture, so I want to separate the text visually somehow).

How would I go about it? Should I create another layer that overlaps text, can I add a background just to the text of the button, or there is something else I can do?

Current structure goes like this:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<LinearLayout style="@style/layout_furniture" >

    <Button
        style="@style/button_furniture"
        android:text="@string/desks" />

</LinearLayout>

</LinearLayout>

Styled like this:

Thank you guys.

P.S. Background is this coded blue gradient for now, but it will be a picture background later on.

Answers


//add this styles to your style="@style/button_furniture"

  <style name="button_furniture">

    <item name="android:textColor">#ffffffff</item>//white text
    <item name="android:textSize">14sp</item>
    <item name="android:shadowColor">#000000</item>//stroke with black
    <item name="android:shadowDx">1</item>
    <item name="android:shadowDy">1</item>
    <item name="android:shadowRadius">1</item>

  </style>

I solved this by changing linear layout container to relative, and adding a new linear one under the button with layout_alignBottom="@id/button". I also applied match_parent width, arbitrary width, horizontal orientation and #22ffffff colored background to the layout.


Need Your Help

Decimal KeyPad for iphone in hybrid app

cordova ionic-framework keyboard decimal

I have a number field with no restriction on amount that can be entered. Business requirement is to show a decimal keypad. We are using input type="number". This works fine in android. I tested in ...

Indy is not working anymore after update

delphi delphi-7 indy

I had all kind of problems with Indy and following someone’s recommendations (at stackoverflow) I have updated to the latest version of Indy - at least this is what I intended to do.