6

画像のサイズを変更せずに、デバイスの画面よりも大きいサイズの画像を表示したいと思います。画面の中央に配置する必要があります。これどうやってするの?

4

4 に答える 4

7

画像ビューでスクロールビューを使用し、そのスクロールビューの高さを設定します

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
    <ImageView
        android:id="@+id/accountIcon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />

</ScrollView>
于 2011-06-23T07:28:01.930 に答える
5

両方向にスクロールするには、通常 (垂直) と水平の ScrollView を使用する必要があることに気付きました。他に方法があれば教えてください。

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/scrollView" >
    <HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/horizontalScrollView">
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/imageView3"
            android:src="@drawable/big_map"/>
        </HorizontalScrollView>
</ScrollView>

画像の左上隅から表示を開始しました。android:layout_gravity="center" を使用しようとすると、右側または下部に白い部分が表示されます。したがって、センタリングは私にとってはうまくいきません。

オプション 2: WebView コントロールを使用し、イメージ onCreate でロードします。

于 2015-03-22T23:02:59.887 に答える
0

Viewから派生し、onDrawを上書きして画面に描画します。

于 2011-06-23T07:12:49.267 に答える