Skip to content

Instantly share code, notes, and snippets.

@cattaka
Last active April 15, 2016 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cattaka/54f23eb2a17a089aec4a to your computer and use it in GitHub Desktop.
Save cattaka/54f23eb2a17a089aec4a to your computer and use it in GitHub Desktop.
RelativeLayoutAnimatorHelper
import android.view.View;
import android.widget.RelativeLayout;
/**
* Save all methods from proguard!!
* <p/>
* Created by cattaka on 2015/11/10.
*/
public class RelativeLayoutAnimatorHelper {
View mView;
public RelativeLayoutAnimatorHelper(View view) {
mView = view;
}
public int getTopMargin() {
return ((RelativeLayout.LayoutParams) mView.getLayoutParams()).topMargin;
}
public void setTopMargin(int v) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mView.getLayoutParams();
params.topMargin = v;
mView.setLayoutParams(params);
}
public int getLeftMargin() {
return ((RelativeLayout.LayoutParams) mView.getLayoutParams()).leftMargin;
}
public void setLeftMargin(int v) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mView.getLayoutParams();
params.leftMargin = v;
mView.setLayoutParams(params);
}
public int getRightMargin() {
return ((RelativeLayout.LayoutParams) mView.getLayoutParams()).rightMargin;
}
public void setRightMargin(int v) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mView.getLayoutParams();
params.rightMargin = v;
mView.setLayoutParams(params);
}
public int getBottomMargin() {
return ((RelativeLayout.LayoutParams) mView.getLayoutParams()).bottomMargin;
}
public void setBottomMargin(int v) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mView.getLayoutParams();
params.bottomMargin = v;
mView.setLayoutParams(params);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment