Code example for FrameLayout.LayoutParams

Methods: setLayoutParams, setMargins

0
			img[0].layout(frame_width / 2 - y1, frame_height - img_height,
					(frame_width / 2 - y1) + img[0].getWidth(),
					(frame_height - img_height) + img[0].getHeight());
 
			int[] img_location = new int[2];
			LayoutParams params3 = new LayoutParams(LayoutParams.WRAP_CONTENT,
					LayoutParams.WRAP_CONTENT);
			img[0].getLocationInWindow(img_location);
			params3.setMargins(img_location[0], img_location[1], 0, 0);
			img[0].setLayoutParams(params3);
			// Log.e("img", location7[0] + "~~" + location7[1]); // 記錄目前位置 
 
			// for (int i = 1; i <= 5; i++) { 
			match_state = isInChangeImageZone(img[fish_random],
					img_location[0], img_location[1]);
			if (match_state == true) {
				Intent returnIntent = new Intent();
				returnIntent.putExtra("result", true);
				setResult(RESULT_OK, returnIntent);
				finish();
Connect your IDE to all the code out there  Get Codota for Java