2017-01-12 25 views
0

我得到的圖像從URL,但它與屏幕不作爲瀏覽器的表現擬合...好心help..i試圖everything..this網址 「http://i.imgur.com/DvpvklR.png」 這裏是圖像enter image description here如何使URL圖像適合Android屏幕?

如果我們運行在瀏覽器的URL,我們可以看到謂我的設備上對其稍加upside..i希望它看起來完美的我的設備

這裏是我的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> 
+0

是否要將圖像設置爲屏幕的背景圖像,並將其他圖像設置爲背景圖像? – fluffyBatman

+0

不是這是第一張圖片其他下面的圖片是第2張和第3張 –

+0

沒有背景圖片其主屏幕圖片 –

回答

0

添加到您的ImageView,

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

不,它仍然相同 –

+0

wotever圖像我採取在url它略微上漲 –

+0

清理您的項目,然後再試 –

1

您可以使用庫稱爲滑行爲此目的

+0

如何使用它到代碼...因爲我有使用picasso的url圖像 –

+0

即時通訊新的android ..所以不要多讀取它...如果你告訴我通過編碼它它wud b grt –

+0

wotever圖像我採取在url它略有上升 –

0

看看它是否工作。

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 


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

     <LinearLayout 
      android:id="@+id/linearLayout1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

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


     </LinearLayout> 

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


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

不只是顯示單個圖像..但頂部仍然是切割 –

+0

我編輯答案發布後立即。你可以再試一次嗎? – fluffyBatman

+0

仍然d相同... –