如何使图像适合整个宽度屏幕没有空白空间在Android?

时间:2016-11-11 17:10:58

标签: android

尝试拍摄的图像适合整个屏幕尺寸宽度,顶部

图片输出应该是这样的:

should be like this

我的应用程序屏幕上的输出如下所示,顶部,左侧和右侧都有空白区域。

Image output 2

我的活动布局XML如下:

         <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>

我的代码显示图片:

    ImageView iv = (ImageView) v. findViewById(R.id.iv);
     Picasso.with(getActivity()).load(slikeZaVesti.get(0))
                            .into(iv); // jpg tag is pasrsed from html

正如您可能观察到的那样,图像的左侧和右侧都有空白区域。有什么方法可以使图像完美地适合屏幕?

0 个答案:

没有答案
相关问题