tags:

views:

32

answers:

1

Hello

Is there a way to use an image size when setting the sizes of a view? I want to create a TextView item with the exact height of a resource image, but I don't want to use the image as a background for the text view.

Thanks a lot

A: 

If you can get the height of the image, you can use TextView's setHeight. If you read in the image as a Bitmap, you can get the image's height with getHeight.

Klarth
Thanks. I created a custom text view and overridden the onMeasure method. The image height I've got it using getResources().getDrawable(R.drawable.header).getMinimumHeight()
Gratzi