Finally, I found the answer. I liked it.
First I created my layout like this.
new_lay.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFFFFF" android:orientation="vertical" > <ScrollView android:id="@+id/sv" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFFFFF" android:orientation="vertical" > <HorizontalScrollView android:id="@+id/hv" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FFFFFF" > <FrameLayout android:id="@+id/ground_gry_fl1" android:layout_width="3193dp" android:layout_height="1815dp" android:background="#FFFFFF" > <FrameLayout android:id="@+id/zoom_lay1" android:layout_width="3193dp" android:layout_height="1815dp" android:background="@drawable/mall_map" > <ImageView android:id="@+id/marker_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" android:visibility="invisible" > </ImageView> </FrameLayout> </FrameLayout> </HorizontalScrollView> </ScrollView> / zoom_lay1" <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFFFFF" android:orientation="vertical" > <ScrollView android:id="@+id/sv" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFFFFF" android:orientation="vertical" > <HorizontalScrollView android:id="@+id/hv" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FFFFFF" > <FrameLayout android:id="@+id/ground_gry_fl1" android:layout_width="3193dp" android:layout_height="1815dp" android:background="#FFFFFF" > <FrameLayout android:id="@+id/zoom_lay1" android:layout_width="3193dp" android:layout_height="1815dp" android:background="@drawable/mall_map" > <ImageView android:id="@+id/marker_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" android:visibility="invisible" > </ImageView> </FrameLayout> </FrameLayout> </HorizontalScrollView> </ScrollView> / marker_image" <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFFFFF" android:orientation="vertical" > <ScrollView android:id="@+id/sv" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFFFFF" android:orientation="vertical" > <HorizontalScrollView android:id="@+id/hv" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FFFFFF" > <FrameLayout android:id="@+id/ground_gry_fl1" android:layout_width="3193dp" android:layout_height="1815dp" android:background="#FFFFFF" > <FrameLayout android:id="@+id/zoom_lay1" android:layout_width="3193dp" android:layout_height="1815dp" android:background="@drawable/mall_map" > <ImageView android:id="@+id/marker_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" android:visibility="invisible" > </ImageView> </FrameLayout> </FrameLayout> </HorizontalScrollView> </ScrollView>
NewClass.java
public class NewClass extends Activity { ImageView mark; FrameLayout ground_gry_fl,zoom_lay; ScrollView sv; float val1 = 0.0f; float val2 = 0.0f; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new_lay); sv=(ScrollView) findViewById(R.id.sv); mark = (ImageView) findViewById(R.id.marker_image); ground_gry_fl = (FrameLayout)findViewById(R.id.ground_gry_fl1); zoom_lay = (FrameLayout)findViewById(R.id.zoom_lay1); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int height = metrics.heightPixels; int width = metrics.widthPixels; System.out.println("width"+width); System.out.println("height"+height); float densityDpi = metrics.density; System.out.println("densityDpi" + densityDpi); val1 = densityDpi * 1064; ; public class NewClass extends Activity { ImageView mark; FrameLayout ground_gry_fl,zoom_lay; ScrollView sv; float val1 = 0.0f; float val2 = 0.0f; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new_lay); sv=(ScrollView) findViewById(R.id.sv); mark = (ImageView) findViewById(R.id.marker_image); ground_gry_fl = (FrameLayout)findViewById(R.id.ground_gry_fl1); zoom_lay = (FrameLayout)findViewById(R.id.zoom_lay1); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int height = metrics.heightPixels; int width = metrics.widthPixels; System.out.println("width"+width); System.out.println("height"+height); float densityDpi = metrics.density; System.out.println("densityDpi" + densityDpi); val1 = densityDpi * 1064; ; public class NewClass extends Activity { ImageView mark; FrameLayout ground_gry_fl,zoom_lay; ScrollView sv; float val1 = 0.0f; float val2 = 0.0f; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new_lay); sv=(ScrollView) findViewById(R.id.sv); mark = (ImageView) findViewById(R.id.marker_image); ground_gry_fl = (FrameLayout)findViewById(R.id.ground_gry_fl1); zoom_lay = (FrameLayout)findViewById(R.id.zoom_lay1); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int height = metrics.heightPixels; int width = metrics.widthPixels; System.out.println("width"+width); System.out.println("height"+height); float densityDpi = metrics.density; System.out.println("densityDpi" + densityDpi); val1 = densityDpi * 1064; ; public class NewClass extends Activity { ImageView mark; FrameLayout ground_gry_fl,zoom_lay; ScrollView sv; float val1 = 0.0f; float val2 = 0.0f; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new_lay); sv=(ScrollView) findViewById(R.id.sv); mark = (ImageView) findViewById(R.id.marker_image); ground_gry_fl = (FrameLayout)findViewById(R.id.ground_gry_fl1); zoom_lay = (FrameLayout)findViewById(R.id.zoom_lay1); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int height = metrics.heightPixels; int width = metrics.widthPixels; System.out.println("width"+width); System.out.println("height"+height); float densityDpi = metrics.density; System.out.println("densityDpi" + densityDpi); val1 = densityDpi * 1064; ; public class NewClass extends Activity { ImageView mark; FrameLayout ground_gry_fl,zoom_lay; ScrollView sv; float val1 = 0.0f; float val2 = 0.0f; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new_lay); sv=(ScrollView) findViewById(R.id.sv); mark = (ImageView) findViewById(R.id.marker_image); ground_gry_fl = (FrameLayout)findViewById(R.id.ground_gry_fl1); zoom_lay = (FrameLayout)findViewById(R.id.zoom_lay1); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int height = metrics.heightPixels; int width = metrics.widthPixels; System.out.println("width"+width); System.out.println("height"+height); float densityDpi = metrics.density; System.out.println("densityDpi" + densityDpi); val1 = densityDpi * 1064;
It must be placed at the same place in every device resolutions. You can scroll the image and see the point. His work fine for me.
malavika
source share