There are various XML attributes for ImageView to scale its content , and various layout views that allow to place views and set their sizes.
Howeve
this is a proof-om-concept custom ImageView, you will need to add missing constructors and perform the Matrix setting whenever ImageView's Drawable changes:
class V extends ImageView {
public V(Context context) {
super(context);
setScaleType(ScaleType.MATRIX);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
Drawable d = getDrawable();
if (d != null) {
Matrix matrix = new Matrix();
RectF src = new RectF(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
RectF dst = new RectF(0, 0, w, h);
matrix.setRectToRect(src, dst, Matrix.ScaleToFit.CENTER);
float[] points = {
0, d.getIntrinsicHeight()
};
matrix.mapPoints(points);
matrix.postTranslate(0, h - points[1]);
setImageMatrix(matrix);
}
}
}
how it works in short:
first the Matrix is set by calling Matrix.setRectToRect() with stf == Matrix.ScaleToFit.CENTER, the result is the same as ImageView.ScaleType.FIT_CENTER
then in order to align the Drawable to the bottom Matrix.mapPoints() is called, it maps the Drawable's left/bottom corner and the result is transformed point as would be seen in the ImageView
and finally Matrix.postTranslate() translates the MAtrix in Y axis to the ImageView's bottom