2013-01-17 2 views
0

[이미지 설명을 여기에 입력하십시오] [1]이 문제로 정신 나간 것입니다. 이미지의 종횡비를 수정할 수 없습니다. 나는 중력과 매트릭스로 시도했지만 종횡비는 유지하지 않습니다. 어떻게 해결할 수 있습니까? 나는 (배열에서) textview 변수 텍스트를 가지고 있고 고정 된 이미지를 갖고 싶습니다.종횡비 이미지 뷰

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#000000" 
android:orientation="vertical" > 

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

<ImageView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@drawable/luna1" 
    android:textSize="15pt" 
    android:layout_weight="1"/> 

<ScrollView 
    android:id="@+id/scrollView10" 
    android:layout_width="match_parent" 
    android:layout_height="fill_parent" 
    android:layout_gravity="center" 
    android:background="#000000" 
    android:layout_weight="1" > 

    <TextView 
     android:id="@+id/textView10" 
     android:layout_width="match_parent" 
     android:layout_height="320dp" 
     android:background="#000000" 
     android:gravity="center" 
     android:textColor="#ffffff" 
     android:textSize="14sp" 
       android:text="jjkjkljkjkldjklsdfjkljklsdfjklsdfjklsdfjklsdfjklsdfjklsdfjklfjlsdfjkl" 
     android:autoLink="web|email" 
     android:textStyle="italic" /> 
</ScrollView> 
</LinearLayout> 

<Button 
android:id="@+id/button10" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:text="Chiudi" /> 

</LinearLayout> 

답변

1

찾고 계시는 분은 scaleType입니다. scaleTypecenterCrop 또는 centerInside과 같이 설정하면 가로 세로 비율이 유지됩니다.

업데이트 :

은 또한 당신이 당신의 이미지를 설정하지 background에 대한 src를 사용하고 있는지 확인하십시오.

+0

방금 ​​시도했지만 문제가 생겼습니다. 감사합니다. –

+0

ImageView에서 'scaleType'을 'centerCrop'으로 설정했는데 가로 세로 비율이 변경 되었습니까? – kabuko

+0

스크린 샷을 첨부했습니다. "달"은 원이어야합니다. –