2012-05-05 10 views
0

URLからImageViewに画像を読み込んでいます。 (RSSフィードから)URLからロードされた画像の解像度に関する問題

問題は、読み込まれた画像の解像度が元の画像よりも低いことです!

私はStackoverflowを検索し、画像の再スケーリングを防ぐために、 "inScaled"オプションをfalseに設定することが解決されていることを発見しました。 しかし、この解決策は私のためには機能しませんでした。ここ

コードである:

URL feedImage= new URL(img_link); 
    HttpURLConnection conn= (HttpURLConnection)feedImage.openConnection(); 
    InputStream is = conn.getInputStream(); 
    BitmapFactory.Options BFoptions = new BitmapFactory.Options(); 
    BFoptions.inScaled = false; 
    Bitmap img = BitmapFactory.decodeStream(is,null, BFoptions); 
    int density = img.getDensity(); Log.e("img", "Image density is " + density); 
    int width =img.getWidth(); Log.e("img", "Image width is " + width); 
    int height = img.getHeight(); Log.e("img", "Image height is " + height); 

    my_image.setImageBitmap(img); 

変数密度、幅と高さは、元画像の値よりも低いです。

とここに私のレイアウトの一部です:

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical"> 


      <ImageView 
        android:id="@+id/joke_image" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"   
        android:contentDescription="temp description"/> 


      <ScrollView 
        android:id="@+id/SV" 
        android:layout_width="fill_parent" 
        android:layout_height="30dp" 
        android:background="@drawable/background" 
        android:paddingTop="10dp" 
        android:paddingLeft="10dp" 
        android:paddingRight="10dp" 
        android:paddingBottom="50dp"> 

        <!-- bla 
         bla 
         bla 

         --> 


      </ScrollView> 
</RelativeLayout> 

事前に感謝

答えて

0

は、最後にそれが解決されました:)

をコードやImageViewsに関連していないように見えました、 .....

RSSフィードのすべての画像は、サムネイルです...アプリでは小さく見えますが、ウェブサイトでは大きく表示されます。

だから、解決策は「_n.jpg」で、各画像のURLの末尾に「_s.jpg」を置き換えることでした:)

私はこの答えは、他の誰か:)

を助けることを願っています