3

and thank for your help.

I have an App Widget with the following layout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/background"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >

<LinearLayout
    android:id="@+id/linear"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:layout_gravity="center"
    android:orientation="vertical"
    android:padding="10dp" >
<ImageView
    android:id="@+id/borderimage"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@id/linear"
    android:layout_alignLeft="@id/linear"
    android:layout_alignRight="@id/linear"
    android:layout_alignTop="@id/linear"
    android:layout_gravity="center"
    android:scaleType="fitCenter"
    android:src="@drawable/box" />

<ImageView
    android:id="@+id/backgroundimage"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@id/linear"
    android:layout_alignLeft="@id/linear"
    android:layout_alignRight="@id/linear"
    android:layout_alignTop="@id/linear"
    android:layout_gravity="center"
    android:padding="2dp"
    android:scaleType="fitCenter"
    android:src="@drawable/gradient_box" />

As you can see I use two ImageView on top of the layout to create a background and a border

  • backgroundimage is the background
  • borderimage is the border

(I need to do this way because the background and the border needs to be changed at runtime).

I would like to add a shadow, to get an effect like this: enter image description here

Any suggestion more than welcome! Thanks

Lisa Anne
  • 4,482
  • 17
  • 83
  • 157

1 Answers1

0

For some widgets that come with a transparent background you can use a background color that is partially transparent, it won't drop a shade but create a similar effect. for example for SeekBar widget use android:background="#55000000"

David Aleksanyan
  • 2,953
  • 4
  • 29
  • 39