2017-03-21 106 views
0

我有點混淆加載到Android設備屏幕或任何數字設備的位圖LED電視屏幕在這裏我的Android手機屏幕分辨率像768x1280像素,我想加載位圖分辨率像3000x2000像素這裏可能有兩種可能性出現,第一種是直接加載位圖而不用調整原始位圖的大小,第二種形式是原始位圖將可調整大小的位圖和加載到設備屏幕上,但問題出現在第一種情況下如何加載較大的位圖進入小設備屏幕,任何人都可以幫助我解決這個問題。更大的位圖如何適應Android設備屏幕

參考考慮此圖像:
這張圖片的圖像分辨率爲3000x2000像素,移動屏幕分辨率爲768x1280像素。

enter image description here

+0

看看這個鏈接的可能性http://abhiandroid.com/ui/scaletype-imageview-example.html – Stallion

+0

大或小沒有區別。目前還不清楚你的屏幕是什麼意思。但是爲了在圖像視圖中顯示位圖,可以使用imageView.setImageBitmap(bitmap)。 (或者那樣)。首先選擇正確的比例類型。 – greenapps

回答

1

使用 「畢加索」 插件: picasso page

例子:

Picasso.with(context).load("link or @drawable/...").into(imageView); 

您可以添加.fit()和圖像將填補ImageView的。

Picasso.with(context) 
.load("link or @drawable/...") 
.fit() 
.into(imageView); 
0

將圖像旋轉90度(在XML外部或內部),然後使用scaleType屬性。

  1. 首先,您既可以將旋轉的圖像添加到資源中,也可以使用XML屬性旋轉它,如下所示。

    <ImageView 
        android:id="@+id/image" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:rotation="90" 
        android:src="@mipmap/your_image" /> 
    
  2. 然後,scaleType屬性(fitCenter,centerInside或centerCrop)

    <ImageView 
        android:id="@+id/image" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:rotation="90" 
        android:scaleType="fitCenter" 
        android:src="@mipmap/your_image" /> 
    

注意縮放:如果你只給scaleType您的ImageView不旋轉然後通過你的形象會被拉伸。

相關問題