2014-01-18 19 views
44

ラッピングありません。残念ながら、デバイスの画面サイズに応じて、ビューをビューの下またはビューの外にプッシュします。画像ビューは、私が<a href="http://www.oceannetworks.ca/sites/default/files/images/pages/maps/ONCMap_simplelabled.jpg">this image</a>をラップImageViewのを持っている内容

http://i.imgur.com/CuVFK5P.png

http://i.imgur.com/6wzMebV.jpg

私はそれを "ハック" することができますが、それはむしろないと思います...

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:padding="16dp" 
android:orientation="vertical" 
tools:context="MapFragment"> 

<ImageView 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:src="@drawable/oncmap"/> 

<TextView 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent" 
    android:text="Neptune" 
    style="@style/sectionHeader"/> 

<TextView 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent" 
    android:paddingLeft="8dp" 
    android:paddingRight="8dp" 
    android:paddingTop="16dp" 
    android:text="@string/info" 
    style="@style/text"/> 

+0

問題はImageViewではなく、全体の.xmlドキュメントを提供する必要があります。 –

+0

イメージが境界内にある必要がある場合は、縮尺の種類fitXYとともにイメージビューの高さと幅を設定してください。 – Srikanth

+0

@DarkoRodic元の投稿を完全なXMLで編集しました - 私は重みを使用していません。 –

答えて

157

ImageViewのに次のフィールドを追加します。

android:scaleType="fitXY" 
android:adjustViewBounds="true" 
+2

ありがとう - これは –

+2

@TylerSebastian大歓迎です:) – sachin10

+2

@Shyildoありがとうございました! –

関連する問題