0

Android アプリケーションを開発しており、画像を全画面表示しようとしています。

これを行うには、次の例のコードを使用します: https://github.com/jasonpolites/gesture-imageview

アクティビティのインターフェイス xml は次のとおりです。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
 xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:gesture-image="http://schemas.polites.com/android"
 android:id="@+id/layout"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:orientation="vertical" 
 android:background="#000000">
  <com.polites.android.GestureImageView
    android:id="@+id/image"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:scaleType="centerInside" 
    gesture-image:min-scale="0.75"
    gesture-image:max-scale="10.0"
    android:src="@drawable/image"/>
</LinearLayout>

しかし、/drawable フォルダーの画像を使用したくありません。URL の img ダウンロードを使用したいのです。

写真をダウンロードして、メモリのどこか、またはフォルダに入れて、このパスをxmlファイルに入れることができないのはどうしてですか?

助けてくれてありがとう!

4

2 に答える 2

0

そんなことはできません。apkのresディレクトリ ファイルはREAD ONLY. 画像の URL を取得して内部ストレージにファイルとして保存し、後でレンダリングするだけです。必要な特定のファイルパスに画像を保存できます。そして、プログラムでそれを表示します。これは、imageview の drawable の画像を置き換えます。

于 2013-05-29T01:29:44.810 に答える