1

I've followed the Stackoverflow post here to use a 9_patch to add a dropshadow. However, it either scales funnily in my layout, or isn't rendered on my phone.

The layout consists of a root horizontal linear layout. The first item is an imageview with my picture. The second item is a table view with buttons. The image and table are supposed to scale to be half and half of the screen, so I set both weights to 1. I set the imageview scale to width=fit_content and height=match_parent and it scales accordingly. However, the backdrop image and padding are incorrectly applied no matter what I try. Individual padding on each side is ignored and I can only apply a uniform padding, but the imageview's background stretches from top to bottom. In effect, though I can scale the image to the desired size, the imageview background seems to fit different dimensions.

Do I need to use a containing layout?

Edit: This is the .xml code. I've tried all sorts of variations with no success.

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:layout_weight="1"
    android:background="@drawable/dropshadowt"
    android:paddingBottom="10dp"
    android:paddingLeft="10dp"
    android:paddingRight="10dp"
    android:paddingTop="10dp"
    android:scaleType="fitCenter"
    android:src="@drawable/x2c2" />

<TableLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:background="@drawable/sgfill" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
    </TableRow>

    <TableRow
        android:id="@+id/tableRow3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
    </TableRow>

    <TableRow
        android:id="@+id/tableRow4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
    </TableRow>
</TableLayout>

Community
  • 1
  • 1
Tickled Pink
  • 969
  • 2
  • 14
  • 26

0 Answers0