marginTop="@dimen/margin_top_height"dimens.xml中定义:
<dimen name="margin_top_height">300dip</dimen>float yOffset = getResources().getDimension(R.dimen.margin_top_height);
TranslateAnimation ani = new TranslateAnimation(0, 0, 0, -yOffset);