Code example for ImageButton

Methods: setLayoutParams

0
	 * @param pos Absolute position of outer-left edge of the slider (0 = left aligned) 
	 */ 
	private void moveSlider(int pos) {
		LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
		params.setMargins(pos, 0, 0, 0);
		mSlider.setLayoutParams(params);
	} 
	 
	/** 
	 * Moves the background to a position. Won't move if all icons already visible. 
	 * @param pos Relative position of all background icons. 
	 */ 
	private void moveBackground(int pos) {
		// only move background if there are more icons than visible 
		if (pos != 0 && mBackMoveFactor > 0) {
			mInverseSliderBackground.offsetLeftAndRight(pos);
			mInverseSliderBackground.invalidate();
		} 
	} 
 
Connect your IDE to all the code out there  Get Codota for Java