2017-08-10 10 views
1

私はAndroidアプリケーションで異常な動作をしています。私は、このXML構成にAndroid:ScaleType = "fitXY"がすべての画像で機能しない

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

    <ImageView 
     android:id="@+id/thumbnail" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:scaleType="fitXY"/> 

    <TextView 
     android:id="@+id/content" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="@dimen/text_margin" 
     android:textAppearance="?attr/textAppearanceListItem" /> 
</LinearLayout> 

を持っている。しかし、私はアプリケーションを実行すると、結果がこの

enter image description here

ある画像1' 、2' および3' は正しいですが、なぜの第三の画像最初の行が正しくありませんか?また、同じ画面上に、同じ問題のある他の列にも別の画像があります。すべての画像のサイズが同じです

答えて

2

linearlayoutをmatch_parentの幅に設定しようとしましたか?

+0

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

+1

私はうれしいです、それは働いた! ^^ –

2
  1. セットの幅match_parent
  2. android:adjustViewBoundsを追加します。あなたはImageViewのは、その描画可能の縦横比を維持 にその境界を調整したい場合は、これをtrueに設定

<ImageView 
     android:id="@+id/thumbnail" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:adjustViewBounds="true" 
     android:scaleType="fitXY"/> 
関連する問題