Tecnologia do Blogger.
RSS

[androidbrasil-dev] Re: Resize Bitmap Proporcional

Eu uso o seguinte cálculo (mas só uso para largura march_parent na imagem:

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
Drawable d = getDrawable();
if (d != null) {
// ceil not round - avoid thin vertical gaps along the left/right edges
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = (int) Math.ceil(width * (float) d.getIntrinsicHeight() / d.getIntrinsicWidth());
setMeasuredDimension(width, height);
} else {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}

Em segunda-feira, 30 de junho de 2014 15h56min01s UTC-3, Pedroso escreveu:
Olá, boa tarde.

Estou precisando fazer o resize de um bitmap.

Tenho a largura desejada. Porém, não encontrei uma função para fazer o resize da altura proporcional.
Existe alguma coisa do tipo? Ou tenho que fazer o cálculo na unha?


Desde já obrigado.

Att.,
--
Pedroso

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário