2012-05-15 71 views
1

我試圖在Horizo​​ntalScrollView中製作一個ImageView,但imageView的寬度是屏幕的兩倍,並且超出邊界。Horizo​​ntalScrollView中的Android ImageView get的兩倍於屏幕的寬度

我的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> 

And a image of what I get (click me!)

有誰知道解決這個問題呢?

問候

+0

我有同樣的問題,但只在我運行Android 4.2.2的Nexus 4上。你的配置是什麼? – l33t

+1

鏈接已損壞。請修復。謝謝。 – Shirane85

回答

5

我複製你的XML和使用我的資源,它看起來完美的,我相信你的資源是大於你覺得是,你應該使用layout_widthlayout_height爲固定的大小,也可以設置scaleType到centerInside。

相關問題