Emre Erol
Emre Erol

Reputation: 460

Imageviews positioning over Imageviews

I have three ImageViews positioned on top of one each other. But when the screen resolution or parent ImageView size changes, the child ImageViews position retain their old position. These old positions are wrong for the new parent ImageView size. How can I calculate the new positions? Or is there another way to solve this problem?

Every image on top of the dummy is an ImageView in this screenshot of my work:

Every parent image on dummy an imageview in this screenshot.

Upvotes: 0

Views: 59

Answers (1)

Emre Erol
Emre Erol

Reputation: 460

I use absolute layout and it's work for me. Here is example code;

        <AbsoluteLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:id="@+id/save"
            android:nestedScrollingEnabled="true"
            android:background="#eeeeee">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="400dp"
                android:id="@+id/imageView"
                android:src="@drawable/dummy2"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="30dp"
                android:layout_alignParentTop="true"
                android:layout_marginTop="0dp"
                android:scaleType="fitStart"
                android:layout_y="20dp"
                android:layout_x="30dp" />


            <ImageView
                android:layout_width="166dp"
                android:layout_height="200dp"
                android:id="@+id/k_altkiy_v"
                android:layout_x="-2dp"
                android:layout_y="170dp" />

            <ImageView
                android:layout_width="120dp"
                android:layout_height="200dp"
                android:id="@+id/k_ustkiy_v"
                android:layout_marginTop="85dp"
                android:layout_alignParentTop="true"
                android:adjustViewBounds="false"
                android:scaleType="fitStart"
                android:layout_x="28dp"
                android:layout_y="66dp" />


            <ImageView
                android:layout_width="128dp"
                android:layout_height="200dp"
                android:id="@+id/k_cek_v"
                android:layout_x="16dp"
                android:layout_y="50dp" />

        </AbsoluteLayout>

Upvotes: 0

Related Questions