I am trying to add ImageButton
's in my Android Application from a list imgBtns
to an already existing ImageView
in this way:
for (int k = 0; k < imgBtns.size(); k++) {
zoomLayout.addView(imgBtns.get(k));
}
The ImageView
is zoomable via an ImageMatrix
that adjusts according to the finger gestures.
My Problem is, that when I add the ImageButton
, the ImageMatrix
of the ImageView
somehow resets and I end up looking at the fully zoomed out image!
I tried assigning the matrix manually after the adding and I played with the LayoutParams
, but it always resets the ImageMatrix
!
Does someone have an idea why this happens and how I can add my ImageButton
's to the zoomed-in ImageView
so that it stays zoomed-in?
EDIT:
It turns out the
ImageMatrix
doesn't get reseted, but something else instead. My guess is, that adding a View to the Layout somehow resets the Layout and its children. I don't know what exactly is going on, but I think changing the Layout after theonCreate()
has some complicated consequences...