2017-01-16 5 views
-1

私は垂直方向に拡張可能な画像を持っています。ピクチャはサーバー(リンク)から取得され、ピカソを使用して表示されます。Scale ImageView from Picassoを使用してサーバーから

多くの参考文献を試しましたが、うまくいきませんでした。これは私のコードです:

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="fill_parent" 
    android:layout_weight="1" 
    android:background="#FCE6C0" 
    android:padding="10dp"> 

    <ScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:scrollbarAlwaysDrawVerticalTrack="true" 
     android:id="@+id/scrollView" > 

     <ImageView 
      android:id="@+id/langkah_resep" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scaleType="fitXY" 
      android:adjustViewBounds="true"/> 
    </ScrollView> 

</LinearLayout> 

これはピカソです:

Picasso 
.with(getBaseContext()) 
.load(langkah_resep) 
.fit() 
.into(imgResep); 

は私がScrollViewを削除すると、画像が表示されますが、私が入れたときにScrollViewの何も表示されません。 ScrollViewに画像をスクロール

答えて

0

は、多くのユーザーが慣れ親しんであるかもしれないものではありません。 ScrollViewに画像を入れたいと思う特別な理由はありますか?

別の可能な解決策は、ScrollViewを削除し、代わりに画像の&ズームをピンチ可能にしてPhotoViewのようなものを使用することです。

参照:https://github.com/chrisbanes/PhotoView

それは同様にピカソと正常に動作します。

0

はImageViewのため & を分高さを追加し、それはトリックを行う必要があります。

<ImageView 
      android:id="@+id/langkah_resep" 
      android:minHeight="64dp" 
      android:minWidth="64dp" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:adjustViewBounds="true" 
      android:scaleType="fitXY" /> 
関連する問題