I'm using this code to create an ImageView and add it to a LinearLayout :
public void inserindoImage(ImageView image,int rid,LinearLayout linear )
{
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
image.setLayoutParams(params);
image.setImageResource(rid);
linear.addView(image);
}
Only LinearLayout
did not accompany imageView
and left a space at the top and bottom of the image.
follows the screen image
xmlcode
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.teste.teste1.Principal"
android:background="#FFEC0D0D">
<ScrollView
android: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
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearImage2"
android:orientation="horizontal">
<!--Imagem vem aqui-->
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
How can I delete this space?