2013-05-07 46 views
0

我批發幫助我自己的對話框:定製的alertDialog

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content"> 

<TextView 
    android:id="@+id/text" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center_horizontal" 
    android:textSize="16sp" 
    android:layout_marginTop="4dp" 
    android:layout_marginLeft="4dp" 
    android:layout_marginRight="4dp" 
    android:layout_marginBottom="4dp" 
    android:hint="@string/pull"/> 

<ImageView 
    android:src="@drawable/tira_cable" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:scaleType="center"/> 
</LinearLayout> 

屏幕寬度是700和圖像寬度爲600,但它沒有正確顯示:

enter image description here

而形象是:

enter image description here

我應該怎麼做?

回答

1

嘗試改變scaletype例如:scaleType="fitXY"

<ImageView 
android:src="@drawable/tira_cable" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:scaleType="fitXY"/> 
1
<ImageView 
    android:src="@drawable/tira_cable" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:scaleType="centerCrop"/> 

或許你需要的是scaleType "centerCrop"