代码里面修改layout_gravity

public void change(View view) {
    LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) mImageVew.getLayoutParams();
    layoutParams.gravity = Gravity.CENTER_VERTICAL;
    mImageVew.setLayoutParams(layoutParams);
}

 




    

RelativeLayout

 

public void change(View view) {
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mImageVew.getLayoutParams();
        layoutParams.removeRule(RelativeLayout.CENTER_VERTICAL);
        layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        mImageVew.setLayoutParams(layoutParams);
    }



    

 

你可能感兴趣的:(Android,开发点滴)