I have some images inside the folder drawable
and I call them via code:
public void inserindoImage(ImageView image,int rid,LinearLayout linear )
{
image.setBackgroundResource(rid);
linear.addView(image);
}
When you call this function, the image goes on the screen.
and stay that way
OriginalImage
IwouldliketoknowhowtomaketheimagekeeptheratioinimagemView
,asyoucanseethereisadeformationintheimage.
xml
<ScrollViewandroid:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:id="@+id/scrollView">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearImage"
android:orientation="horizontal">
<!--Imagem vem aqui-->
</LinearLayout>
</LinearLayout>
</ScrollView>
In the case I put one, but there comes more image so the scroolView
.