2010-11-21 5 views
1

私のmain.xmlには画像マーカーがデバイスの幅を埋めるものはありませんか?なぜ画像が幅を埋めていないのですか

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:screenOrientation="portrait"> 

<ImageView 
    android:id="@+id/ImageView01" 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent"   
    android:src="@drawable/marker"> 
</ImageView> 

</LinearLayout> 

答えて

6

ImageViewの高さはwrap_contentに設定されています。つまり、ImageViewは選択した画像に必要なだけのスペースを取ることになります。画面全体を表示したい場合は、layout_heightをfill_parentに変更してください。

また、android:scaleType=""でImageView scaleTypeを選択することもできます。

+0

上記のfill_parentに幅を設定しましたか?scaleTypeをチェックします。ちょうど今それは働いた。このエミュレータは地獄のようにバギーで、半分の時間は半分の時間で動作しない。 –

+0

ああ、私は高さを意味した、すみません。私はそれを編集しますImageViewの高さを変更します。 – kcoppock

1

android:adjustViewBounds="true" 

やAndroid APIDemosで

image_view_1.xml 

をチェックしてみてください。

助けが必要です。

+0

私はそれを今テストしたところで働いていました。エミュレータはバグがあります。 –

関連する問題