1

Horizo​​ntalScrollView 内に ImageView を作成しようとしていますが、imageView は画面の幅の 2 倍になり、境界の途中で終了します。

私のXML:

<?xml version="1.0" encoding="utf-8"?>

<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/horizontalScrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent" >


<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="top"
    android:baselineAligned="true"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/penguins" />
</LinearLayout>

</HorizontalScrollView>

そして、私が得たものの画像(クリックしてください!)

誰もこの問題の解決策を知っていますか?

ご挨拶

4

1 に答える 1

5

私はあなたのxmlをコピーし、私のリソースを使用すると完璧に見えます.あなたのリソースはあなたが思っているよりも大きいと思います.おそらく修正サイズとしてlayout_widthandを使用し、 layout_heightscaleTypeをcenterInsideに設定する必要があります.

于 2012-11-12T21:31:19.417 に答える