Hi,

I'm trying to add a drawable to a layout, using an ImageView, but the
drawable doesn't maintain its size and is rendered at 1dp x 1dp.

I've called ImageView.setAdjustViewBounds as per the android
documentation but this doesn't seem to help. The Drawable is only
visible when the ImageView's height and width are set and the drawable
is then rendered at those dimensions.

Here's the code and layout:

rect_blue.xml
-------------------

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android";
android:height="50dp" android:width="100dp" android:shape="rectangle">
    <solid android:color="#FFFF00FF" />
    <corners android:radius="5dp" />
</shape>

FlipView.java (Derived from FrameLayout)
-----------------------------------------------------------

ImageView drawableContainer = new ImageView(context);
drawableContainer.setImageResource(R.drawable.rect_blue);
drawableContainer.setAdjustViewBounds(true);

this.AddView(drawableContainer);

Layout Overview
----------------------

RelativeLayout
     -> FrameLayout
          -> ImageView (With drawable set as content)

I'm sure I'm doing pretty much exacly the same as the example here:
http://developer.android.com/guide/topics/graphics/2d-graphics.html.
Could it be because I'm using a FrameLayout that this is not working?

Thanks!

Andy

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to