Tuesday 25 June 2013

Zooming for Layout in Android

                                       Layout Zooming in Android


Follow this link http://stackoverflow.com/questions/4772565/how-to-make-a-scrollable-layout-and-zoomable-layout-in-an-android-app

1.First Add Android_ZoomViiew.jar(download jar file from this link https://code.google.com/p/android-zoom-view/downloads/list) in libs folder and follow the below source code


import pl.polidea.view.ZoomView;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;

public class Zoom extends Activity {
private ZoomView zoomView;
LinearLayout main_container;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.main);

View v = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE))
.inflate(R.layout.activity_main, null, false);
v.setLayoutParams(new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

zoomView = new ZoomView(this);
zoomView.addView(v);

main_container = (LinearLayout) findViewById(R.id.linearLayout2);
main_container.addView(zoomView);
}

}



1 comment:

  1. thank you so much..
    It's working for me..
    It will be very useful and save time...

    ReplyDelete