List of utility methods to do View Set
void | doAfterLayout(final View view, final Runnable runnable) Runs a piece of code after the next layout run final OnGlobalLayoutListener listener = new OnGlobalLayoutListener() { @SuppressWarnings("deprecation") @Override public void onGlobalLayout() { view.getViewTreeObserver().removeGlobalOnLayoutListener( this); runnable.run(); }; view.getViewTreeObserver().addOnGlobalLayoutListener(listener); |
void | initializeDrawListener(View view) initialize Draw Listener System.out .println("FirstFrameAnimatorHelper initializeDrawListenert"); if (sGlobalDrawListener != null) { view.getViewTreeObserver().removeOnDrawListener( sGlobalDrawListener); sGlobalDrawListener = new ViewTreeObserver.OnDrawListener() { private long mTime = System.currentTimeMillis(); ... |
void | layoutViewAtPos(View view, int offsetX, int offsetY) layout View At Pos view.layout(offsetX, offsetY, offsetX + view.getMeasuredWidth(), offsetY + view.getMeasuredHeight()); |
void | makeMultiline(View view) make Multiline if (view instanceof ViewGroup) { ViewGroup grp = (ViewGroup) view; for (int index = 0; index < grp.getChildCount(); index++) { makeMultiline(grp.getChildAt(index)); } else if (view instanceof TextView) { TextView t = (TextView) view; t.setSingleLine(false); ... |
void | measureExactly(View view, int width, int height) measure Exactly int widthSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY); int heightSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY); view.measure(widthSpec, heightSpec); |
void | positionAndResizeView(View v, Rect rect) position And Resize View RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
v.getLayoutParams().width, v.getLayoutParams().height);
params.setMargins(rect.left, rect.top, 0, 0);
v.setLayoutParams(params);
|
void | showCheatSheet(final View view) Display a Toast letting the user know what an item does when long pressed. final int[] screenPos = new int[2]; final Rect displayFrame = new Rect(); view.getLocationOnScreen(screenPos); view.getWindowVisibleDisplayFrame(displayFrame); final Context context = view.getContext(); final int viewWidth = view.getWidth(); final int viewHeight = view.getHeight(); final int viewCenterX = screenPos[0] + viewWidth / 2; ... |
void | transparent(View view, boolean transparent) transparent float alpha = 1; if (transparent) alpha = 0.5f; setAlpha(view, alpha); |
void | viewBaseSetting(View target) view Base Setting target.setFadingEdgeLength(0); target.setWillNotCacheDrawing(true); target.setBackgroundColor(0x00000000); |