2012-03-26 22 views
0

同じ高さの3つの異なる画像で3つの画像ビューを保持しています。後述するように私のコードは、..私は(私はそれのための重みパラメータを使用するように持っていけない)これらのイメージを管理することができた大規模なレイアウトでAndroid:画像ビューでのレイアウトの問題

<LinearLayout 
    android:id="@+id/LinearLayout06" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:gravity="left" android:layout_gravity="center_vertical|center_horizontal"> 

    <ImageView 
     android:id="@+id/stopServiceButton" 
     android:layout_width="wrap_content" 
     android:layout_height="80dp" 
     android:layout_weight="1" 
     android:adjustViewBounds="true" 
     android:background="@null" 
     android:paddingRight="5dp" 
     android:src="@drawable/stop_service_button_selector" /> 

    <ImageView 
     android:id="@+id/calibrateButton" 
     android:layout_width="wrap_content" 
     android:layout_height="80dp" 
     android:layout_weight="1" 
     android:adjustViewBounds="true" 
     android:background="@null" 
     android:padding="5dp" 
     android:src="@drawable/calibrate_button_selector" /> 

    <ImageView 
     android:id="@+id/doneButton" 
     android:layout_width="wrap_content" 
     android:layout_height="80dp" 
     android:layout_weight="1" 
     android:adjustViewBounds="true" 
     android:background="@null" 
     android:padding="5dp" 
     android:src="@drawable/done_button_selector" /> 


</LinearLayout> 

ですが、小さなレイアウトのために、私はに一つとして、重みパラメータを維持する必要があります画面にフィットさせますが、高さは以下のように変わります。 Image

誰かが私を助けることができますか?

+0

なぜあなたはandroid:srcを使って背景を追加していますか?アンドロイドを使用してみてください:背景 –

+0

すべての画像の幅を塗りつぶしに置き換えてチェックしてください。 –

+0

うん、背景が変わってしまいましたが、画像のテキストがぼやけました。 –

答えて

0

android:adjustViewBounds = "true"は画像の縦横比を保持します。幅はコンテンツをラップするため、それに応じて高さが下がります。

+0

yea ..それは縦横比を保持します..しかし、私は正しく与えていない... :) –

0

commentに記載されているぼかし効果を減らすには、android:filterの属性をドロワーブルに設定してみてください。