2012-03-26 79 views
0

我保持三个图像视图与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来添加背景?尝试使用android:background – 2012-03-26 14:00:40

+0

检查通过替换所有imageview宽度fillparent和重量1 – 2012-03-26 14:04:28

+0

是啊,改变到背景工作,但图像中的文字变得模糊 – 2012-03-26 14:11:29

回答

0

android:adjustViewBounds =“true”保留了图像的宽高比。由于宽度要包装内容,所以高度相应地减小。

+0

是啊..它保留了长宽比..但我的基本问题是重量我没有给予适当的...... :) – 2012-04-13 17:37:07

0

为了减少您在comment中提到的模糊效果,您可以尝试将android:filter属性设置为drawables。