2

I use an ImageView, I want the source image to fit to the TOP and RIGHT.

FitEnd scaling fits BOTTOM and RIGHT all other scale enums don't help much as well

any idea?

Thanks

Hardy
  • 2,576
  • 1
  • 23
  • 45
Gilad
  • 643
  • 1
  • 7
  • 20

3 Answers3

4

Try this code

<LinearLayout
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:gravity="top|right">
   <ImageView
       android:scaleType="fitEnd"
       android:adjustViewBounds="true" />
</LinearLayout>

This should get you the intended result.

Andy
  • 6,869
  • 2
  • 31
  • 24
PravinCG
  • 7,688
  • 3
  • 30
  • 55
  • This is a poor answer because the code is scrappy (has inconsistent use of double quotes) and the short explanatory paragraph provides little illumination. – Carlos P Jan 29 '13 at 18:12
  • 3
    @CarlosP I guess you forgot to read that it is a psuedo code. I do not believe in spoon feeding answers and expect some effort from the other side. – PravinCG Jan 30 '13 at 04:09
0

I beleive you are looking for the fitStart or, in code, setScaleType(ImageView.ScaleType.FIT_START);

Using that you could simply wrap the image in a layout wrapper that is aligned to the right, such as a RelativeLayout with android:layout_alignParentRight="true"

Abandoned Cart
  • 4,512
  • 1
  • 34
  • 41
0

Just use scaleType = MATRIX

e.g:

<ImageView
    android:layout_width="%wanted width%"
    android:layout_height="%wanted height%"
    android:scaleType="matrix"
    android:src="%your src%" />
gor
  • 1,046
  • 1
  • 14
  • 28