Tried to make image taken to fit the whole screen size width, and top
Picture output should be like this:
The output on the screen of my app is as below with blank space on top, left and right side.
My XML for the activity layout is below:
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/vestGlavnaSlikaLayout"
android:layoutDirection="ltr">
<ImageView
android:id="@+id/iv"
android:layout_width="match_parent"
android:fitsSystemWindows="false"
android:scaleType="fitXY"
android:layout_marginTop="-20dp"
android:focusable="false"
android:cropToPadding="false"
android:adjustViewBounds="true"
android:layout_alignParentBottom="false"
android:layout_alignParentRight="false"
android:layout_height="wrap_content"
android:layout_marginLeft="-20dp"
android:layout_alignParentEnd="false"
android:layout_marginRight="-20dp" />
<TextView
android:background="@android:color/black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tekstglavnevesti"
android:textColor="@android:color/background_light"
android:textSize="20dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:textStyle="normal|bold" />
</RelativeLayout>
My code to display the image:
ImageView iv = (ImageView) v. findViewById(R.id.iv);
Picasso.with(getActivity()).load(slikeZaVesti.get(0))
.into(iv); // jpg tag is pasrsed from html
As you l might observe, there are blank spaces at both left and right side of the image. Any way to make the image fit perfectly onto the screen?