如何在URL上将URL图像放入屏幕? [英] How to fit URL image into the screen on android?

查看:118
本文介绍了如何在URL上将URL图像放入屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从网址获取图片,但它不适合屏幕,因为它在浏览器上显示...请帮助..我尝试了一切..这个网址

i am getting image from url but its not fitting with the screen as its showing on browser...kindly help..i tried everything..this the url "http://i.imgur.com/DvpvklR.png" here is the image

如果我们在浏览器上运行网址,我们可以在我的设备上看到它略微上升......我希望它在我的设备上看起来很完美

if we run the url on browser, we can see tht on my device its slightly upside..i want it to look perfect on my device

这是我的xml文件:

<RelativeLayout xmlns: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"

    >


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="vertical">

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="0.7">

            <ImageView
                android:id="@+id/ms1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="fitXY"
                android:src="@drawable/main1" />


        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="0.3">


            <ImageView
                android:id="@+id/ms2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight=".5"

                android:scaleType="fitXY"

                android:src="@drawable/pl2" />

            <ImageView
                android:id="@+id/ms3"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight=".5"
                android:scaleType="fitXY"
                android:src="@drawable/l1" />
        </LinearLayout>
    </LinearLayout>


</RelativeLayout>


推荐答案

将此添加到您的Imageview,

Add this to your Imageview ,

                android:adjustViewBounds="true"
                android:layout_alignParentBottom="true"
                android:layout_alignParentTop="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentRight="true"

这篇关于如何在URL上将URL图像放入屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆