2013-09-24 37 views
-1

我正在開發基於客戶端 - 服務器應用程序的應用程序。我陷入了一個愚蠢的問題,發生了什麼事。?我使用tablelayout,並在tablelayout中添加一些文本視圖,編輯文本和圖像(點擊)。我的截圖如下:enter image description here圖片橫向排列

正如你在我的圖片中看到的添加按鈕模糊。這只是一個3kb的文件。

 final ImageView img_add_icon = new ImageView(MainScreen.this); 
    img_add_icon.setBackgroundResource(R.drawable.add_item_order); 

和我的XML文件是:

 <ImageView 
        android:id="@+id/add_to_order_id" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_margin="2dip"/> 

我能做些什麼來阻止這種影像的模糊?

+3

使用'setImageResource'代替'setBackgroundResource' –

+0

發佈整個佈局。我想你在佈局中使用一些重量,或者可能是一些其他的屬性,使它像這樣。並在可繪製的add_item_order – DropAndTrap

+0

@SherifelKhatib中映射圖像的調整。你的寫作只是逃避而已。 – DJhon

回答

0
Please Use 

    setImageResource(resId) 

    to Sets a drawable as the content of this ImageView. 

    To Control how the image should be resized or moved to match the size of this ImageView 
    use 

    setScaleType(ImageView.ScaleType scaleType) 


    [1]: http://developer.android.com/reference/android/widget/ImageView.html#setImageResource%28int%29 
    [2]: http://developer.android.com/reference/android/widget/ImageView.html#setScaleType%28android.widget.ImageView.ScaleType%29