0

Is it possible to use an ImageView as parent? I want to put a few TextViews on an ImageView and when the user zooms on ImageView, I want TextViews to be zoomed too!

Note: I made a zoom-able ImageView but i can't make a zoom-able RelativeLayout...

EDIT:

my xml:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">

    <nikdan.m.metro.ZoomableImageView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:id="@+id/imgMap"
         android:layout_gravity="center" />

    <TextView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:textAppearance="?android:attr/textAppearanceLarge"
         android:text="Hello"
         android:id="@+id/text"
         android:layout_gravity="center"
         android:textColor="#ff0000" />
</FrameLayout>
M.Nik
  • 81
  • 1
  • 8
  • It should be possible using `setScaleX`, `setScaleY`, `setPivotX`, setPivotY` to make a zoomable View. But I wouldn't expect anyone on stackoverflow to give you the code ready to use. – Budius Sep 20 '16 at 22:20
  • If the content of the TextView doesn't change, you could cheat by making the image the ZoomableImageView the cached view bitmap of the framelayout by registering a global pre draw listener – FunkTheMonk Sep 21 '16 at 00:39

1 Answers1

1

Make FrameLayout as the Parent and add TextViews after the ImageView.

That should do the trick.

Elltz
  • 10,730
  • 4
  • 31
  • 59
android_Muncher
  • 1,057
  • 7
  • 14