Java Code Examples for android.widget.FrameLayout#setY()
The following examples show how to use
android.widget.FrameLayout#setY() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HighlightAnimation.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override public void animate() { final FrameLayout highlightFrame = new FrameLayout(view.getContext()); LayoutParams layoutParams = new LayoutParams(view.getWidth(), view.getHeight()); ImageView highlightView = new ImageView(view.getContext()); highlightView.setBackgroundColor(color); highlightView.setAlpha(0.5f); highlightView.setVisibility(View.VISIBLE); final ViewGroup parentView = (ViewGroup) view.getParent(); final int positionView = parentView.indexOfChild(view); parentView.addView(highlightFrame, positionView, layoutParams); highlightFrame.setX(view.getLeft()); highlightFrame.setY(view.getTop()); parentView.removeView(view); highlightFrame.addView(view); highlightFrame.addView(highlightView); highlightView.animate().alpha(0).setInterpolator(interpolator) .setDuration(duration) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { highlightFrame.removeAllViews(); parentView.addView(view, positionView); view.setX(highlightFrame.getLeft()); view.setY(highlightFrame.getTop()); parentView.removeView(highlightFrame); if (getListener() != null) { getListener().onAnimationEnd( HighlightAnimation.this); } } }); }
Example 2
Source File: HighlightAnimation.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override public void animate() { final FrameLayout highlightFrame = new FrameLayout(view.getContext()); LayoutParams layoutParams = new LayoutParams(view.getWidth(), view.getHeight()); ImageView highlightView = new ImageView(view.getContext()); highlightView.setBackgroundColor(color); highlightView.setAlpha(0.5f); highlightView.setVisibility(View.VISIBLE); final ViewGroup parentView = (ViewGroup) view.getParent(); final int positionView = parentView.indexOfChild(view); parentView.addView(highlightFrame, positionView, layoutParams); highlightFrame.setX(view.getLeft()); highlightFrame.setY(view.getTop()); parentView.removeView(view); highlightFrame.addView(view); highlightFrame.addView(highlightView); highlightView.animate().alpha(0).setInterpolator(interpolator) .setDuration(duration) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { highlightFrame.removeAllViews(); parentView.addView(view, positionView); view.setX(highlightFrame.getLeft()); view.setY(highlightFrame.getTop()); parentView.removeView(highlightFrame); if (getListener() != null) { getListener().onAnimationEnd( HighlightAnimation.this); } } }); }