Code example for ImageView

Methods: measuresetLayoutParams

	private ImageAware mImageAware;
	public void setUp() throws Exception { 
		mActivity = new Activity();
		// Make and set view with some prelim values to test 
		mView = new TestImageView(mActivity);
		mView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
		mView.measure(View.MeasureSpec.makeMeasureSpec(250, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(250, View.MeasureSpec.EXACTLY));
		mImageAware = new ImageViewAware(mView);
	public void testGetImageSizeScaleTo_useImageActualSize() throws Exception { 
		// We layout the view to give it a width and height 
		mView.measure(View.MeasureSpec.makeMeasureSpec(200, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(200, View.MeasureSpec.EXACTLY));
		mView.layout(0, 0, 200, 200);
Stop searching for code, let great code find you!  Add Codota to your java IDE