RelativeLayout requestLayout - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for RelativeLayout requestLayout method.

This code example shows how to use the following methods:setLayoutParams, requestLayout
		RelativeLayout.LayoutParams rlp = mLayoutPos;
		rlp.leftMargin = x;
		rlp.rightMargin = -x;
		rlp.topMargin = y;
		rlp.bottomMargin = mHeight / 2 - y;
		mLayout.setLayoutParams(rlp);
		mLayout.requestLayout();
	} 
 
	public void close() { 
 
		if (mIsVisible) {
			mIsVisible = false;
			mLayout.setVisibility(View.GONE);
			onClose(); 
		} 
	} 
 
	public boolean isOpen() { 
		return mIsVisible;
4
CodeRank
This code example shows how to use the following methods:getLayoutParams, requestLayout, setGravity
 
	private void expandItem(int position) {
		final int first = getFirstVisiblePosition();
		RelativeLayout v = (RelativeLayout) getChildAt(position - first);
		if (v != null && mFloatView != null) {
			ViewGroup.LayoutParams lp = v.getLayoutParams();
			int oldHeight = lp.height;
			if (lp.height == mItemHeightCollapsed && position == mSrcDragPos) {
				lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
			} else if (lp.height == ViewGroup.LayoutParams.WRAP_CONTENT
					&& position != mExpDragPos) {
				lp.height = v.getHeight() + mFloatViewHeight;
				if (position > mSrcDragPos)
					v.setGravity(Gravity.TOP);
				else 
					v.setGravity(Gravity.BOTTOM);
			} 
			if (lp.height != oldHeight)
				v.requestLayout();
		} 

4
CodeRank

Related RelativeLayout requestLayout Questions & Answers:

requestLayout Method Overview
Call this when something has changed which has invalidated the layout of this view.
See Code Examples for other Android RelativeLayout Methods: