public RelativeLayoutStick alignParentBottom() { return alignParentBottom(true); }
public RelativeLayoutStick alignParentRight() { return alignParentRight(true); }
public RelativeLayoutStick alignParentTop() { return alignParentTop(true); }
.alignParentTop() .alignParentRight() .stick(); .centerInParent() .stick(); .below(R.id.center) .alignLeft(R.id.center) .stick(); .toLeftOf(R.id.center) .alignTop(R.id.center) .stick(); textView.setId(R.id.bottom_center_horizontal); chop(textView).isInRelative(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) .alignParentBottom() .centerHorizontal() .stick();
public RelativeLayoutStick centerInParent() { return centerInParent(true); }
public RelativeLayoutStick centerHorizontal() { return centerHorizontal(true); }
public RelativeLayoutStick alignParentLeft() { return alignParentLeft(true); }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public RelativeLayoutStick alignParentEnd() { return alignParentEnd(true); }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public RelativeLayoutStick alignParentStart() { return alignParentStart(true); }
/** * Choose the right builder stick according to layout params type * * @param layoutParamsType say {@link android.widget.LinearLayout.LayoutParams} * @param useExistingLayoutParams if true, no LayoutParams will be instantiated * @param width if not useExistingLayoutParams, new LayoutParams will use this as its width * @param height if not useExistingLayoutParams, new LayoutParams will use this as its height * @param <LP> the LayoutParam generic type * @return the corresponding builder stick */ private <LP extends ViewGroup.LayoutParams> Chopstick isInLayout(Class<LP> layoutParamsType, boolean useExistingLayoutParams, int width, int height){ LP lp = useExistingLayoutParams ? useExistingLayoutParams(layoutParamsType) : useNewLayoutParams(layoutParamsType, width, height); if (RelativeLayout.LayoutParams.class.equals(layoutParamsType)) { return new RelativeLayoutStick((RelativeLayout.LayoutParams) lp, mView); } else if(LinearLayout.LayoutParams.class.equals(layoutParamsType)){ return new LinearLayoutStick((LinearLayout.LayoutParams)lp, mView); } throw new UnsupportedOperationException("This Layout is not currently supported. A PR is welcome!"); }