Wiki about android-zoom-view.jar

后端 未结 2 1954
感动是毒
感动是毒 2021-01-13 01:09

Is there any Wiki or any documents on how to implement android-zoom-view.jar. I found it on http://code.google.com/p/android-zoom-view/ and i wanna try to use it on my appli

2条回答
  •  灰色年华
    2021-01-13 01:39

    I wanna share my code on how to use the android-zoom-view.jar. This is how I use it.

    1. Create a new layout (R.layout.zoomable_view) for Views that i want to apply the zooming functionality.
    2. Place it inside ZoomView.
    3. Then place the ZoomView to the main container where you want to show the zoomable view.

      private ZoomView zoomView;
      
      @Override
      protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_zoomable);
      
         View v = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.zoomable_view, 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.main_container);
         main_container.addView(zoomView);            
      }
      

    I hope this will help others.

提交回复
热议问题