How do i adjust ImageView if it falls outside of view Switcher bounds?

114 Views Asked by At

hhh

i have view switcher(it contains 2 views of kettle - on and off)

the first image is kettle "off" , and it stays outside of actual viewSwitcher.

I tried fitXY, fixStart, fitCenter - did not help! Below is the layout of viewSwitcher kkk

I already tried to change the size of kettle image itself - it does not help

How do i make it stay in bounds of the view Switcher?

2

There are 2 best solutions below

0
florent champigny On BEST ANSWER

Make you imageView scaleType centerInside and set adjustViewBounds as true

android:scaleType="centerInside"
android:adjustViewBounds="true"
0
Bojan Kseneman On

Apply this to your ImageView

android:adjustViewBounds="true"

If it's not scaled properly with fitXY, change it to this

android:scaleType="centerInside"