2013-08-22 2 views
0

내 화면에 작은 이미지가있는 이미지보기가 있습니다. 사용자가 클릭 할 때 전체 크기의 이미지를 보길 원합니다. 그래서 나는 ImageView만을 가질 수있는 커스텀 레이아웃으로 취소 가능한 대화 상자를 만들 것이라고 생각했습니다.Android 대화 상자 사용자 정의 레이아웃

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

<ImageView 
    android:id="@+id/img_product_full" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:contentDescription="@string/desc_full_product_image" 
    android:scaleType="fitCenter" /> 

</LinearLayout> 

문제는 내가 모든 치수가 표시된 경우에도입니다 나는 아직도 이미지와 대화 국경을 사이에 약간의 차이를 볼 수 "wrap_content"로 : 그래서 나는이 레이아웃을 만들었습니다. padding:"0dp"을 설정하려고 시도했지만 minHeight 및 minWidth를 0dp로 설정했지만 사용할 수는 없지만 여전히 그 차이가 있습니다. 어떻게하면이 차이를 없앨 수 있습니까? 대화 상자 테두리를 이미지 테두리에 인접하게하려면 어떻게합니까?

답변

0
<ImageView android:id="@+id/img_product_full" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:contentDescription="@string/desc_full_product_image" 
     android:scaleType="fitXY" 
     android:adjustViewBounds="true" /> 

fitXY/adjustViewBounds 특성은이 문제를 해결해야한다.

+0

나는 그것을 시도했지만 이미지가 늘어나고 교란되었다. – Igal

+0

android : adjustViewBounds = "true"내 다음 추측이 될 것입니다 –

+0

훌륭합니다. 고마워요! – Igal

관련 문제