2014-03-31 3 views
0

뷰의 맨 위에 이미지 뷰가있는 뷰를 만듭니다. 이미지 크기는 1080-800 픽셀입니다. HTC One을 살펴 본다면 완벽합니다. 이미지 너비는 전체 화면을 차지합니다. 더 크거나 더 짧은 다른 장치를 가져 가면 이미지가 작거나 커집니다! drawable-xxhdpi 폴더에 이미지를 저장합니다. 포토샵으로 크기를 다르게 조정해야합니까?이미지 뷰를 다른 장치로 확대

enter image description here

당신이 볼 수있는, 왼쪽의 크기는 내가 오른쪽에 하나 같이 큰 장치를 처리 할 수있는 방법 PERFEKT, 그러나?

코드 :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:id="@+id/layout"> 

<TextView 
    android:id="@+id/textView2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Crunch" 
    android:textAppearance="?android:attr/textAppearanceLarge" /> 

<ScrollView 
      android:id="@+id/scrollView1" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" > 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical" > 



<HorizontalScrollView 
    android:id="@+id/horizontalScrollView1" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="horizontal" > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="horizontal" > 




      <ImageView 
    android:id="@+id/imageView2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/crunch1" /> 

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/crunch2" /> 

    </LinearLayout> 
</HorizontalScrollView> 

<TextView 
    android:id="@+id/textView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/crunch" /> 



<TextView 
    android:id="@+id/TVTimer" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="" /> 

<Button 
    android:id="@+id/pause" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center" 
    android:onClick="verlaufKlick" 
    android:text="@string/pause" 
    android:visibility="invisible" 
     /> 

</LinearLayout> 
     </ScrollView> 

</LinearLayout> 

답변

2

변경이

android:layout_width="wrap_content" 

android:layout_width="match_parent" 

및 추가

android:adjustViewBounds="true" 
+0

나는 @ 결합이 대답을 생각한다 wael의 대답이 최선의 선택입니다 - Wael의 대답은 좋은 이미지입니다. 크기가 큰 버전 (OOM 오류가 발생할 수 있음) 만 사용하려면 메모리에 큰 이미지를 가져 오지 않을 것이고 TheOsirian의 대답은 이미지가 화면의 전체 너비로 표시되고 바둑판 식으로 배열되지 않음 – panini

+0

이 두 이미지 -보기에 추가하지만, 아무런 변화가 없습니다. – basti12354

+0

아마도 'android : scaleType = "centerInside"를 설정해야 할 것입니다. – TheOsirian

2

은 그래서 안드로이드가 자동으로 화면 해상도에 해당하는 이미지를 선택합니다

drawable-hdpi, drawable-mdpi, drawable-ldpi, drawable-xhdpi, drawable-xxhdpi 

enter image description here

에서 다른 해상도로 (같은 이름) ​​이미지를 넣어

+0

감사합니다. 1080 * 800 크기의 이미지를 xxhdpi에 넣었습니까? 큰 것을 어디에 두어야합니까? – basti12354

+0

더 큰 것을 drawable-xhdpi에 넣고 가장 큰 것을 drawable-xxhdpi에 넣어야합니다. – wael

관련 문제