마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

안드로이드 서로 다른 해상도에서 이미지 출력 관련

0 추천

안녕하세요 이미지를 출력 관련해서 질문있습니다.

1번 이미지는 갤탭10.1 화면이고

2번 이미지는 갤S2 화면입니다.

제가 하고 싶은건 각 화면 에서 빨간색 영역 안에 위 아래 빈공간들을 없애고 싶습니다.

사용 기종에 따라 빈공간 크기도 서로 다르져..

xml 에서만 처리하고 싶은데 방법 없을까여?? 혹시 xml 에서만 처리하기 힘들다면 코드로 처리하는 방법이라도 조언해주시면 감사드리겠습니다

아, 참고로 이미지 크기는 실제로 730x460 입니다~

 

-1번 갤탭10.1-

 

-2번 갤S2-

 

 

제가 하려고 하는 레이아웃 배치는 다음과 같습니다. 갤탭과 갤2 모두 다음과 같이 이미지가 뜨게 하고싶어요

 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main_layout_framechanger"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="10dp">
    
    <Button 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=" Hello World "
        android:textStyle="bold"
        android:textColor="@color/white"
        android:background="@color/darkorange"/>
    
    <ScrollView 
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        
        <RelativeLayout 
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal">
            
            <LinearLayout
                android:id="@+id/main_layout_framechanger_row_01"
	            android:layout_width="wrap_content"
	            android:layout_height="wrap_content"
            	android:background="@xml/border"
	            android:orientation="horizontal">
	            <ImageView
	                android:layout_weight="1"
	                android:layout_width="0dp"
	                android:layout_height="match_parent"
	                android:src="@drawable/ic_wallet"/>
	            <ImageView
	                android:layout_weight="1"
	                android:layout_width="0dp"
	                android:layout_height="match_parent"
	                android:src="@drawable/ic_wallet"/>
            </LinearLayout>
            
            <LinearLayout
                android:id="@+id/main_layout_framechanger_row_02"
                android:layout_below="@+id/main_layout_framechanger_row_01"
	            android:layout_width="wrap_content"
	            android:layout_height="wrap_content"
            	android:background="@xml/border"
	            android:orientation="horizontal">
	            <ImageView
	                android:layout_weight="1"
	                android:layout_width="0dp"
	                android:layout_height="match_parent"
	                android:src="@drawable/ic_wallet"/>
	            <ImageView
	                android:layout_weight="1"
	                android:layout_width="0dp"
	                android:layout_height="match_parent"
	                android:src="@drawable/ic_wallet"/>
            </LinearLayout>
        </RelativeLayout>
    </ScrollView>
</LinearLayout>

 

껌돌이 (410 포인트) 님이 2013년 4월 30일 질문
껌돌이님이 2013년 4월 30일 수정

1개의 답변

0 추천
 
채택된 답변
예를들어 730x500 크기의 ImageView에  730x460크기의 이미지를 설정하면

위아래 20씩 빈공간이 생깁니다.

이 빈공간을 없애려면 ImageView에 android:scaleType="fitXY" 속성을 추가해주면 됩니다.

이렇게하면 뷰의 X, Y에 꽉차게 이미지가 나옵니다.

결국엔 위아래로 20씩 늘려주게 되서 이미지가 원하던것과 다르게 나오게 됩니다.

 

ImageView의 크기는 비율로 잡아주셧으니 이미지를 뷰크기에 맞춰서 제작하고

ImageView에 android:scaleType="fitXY"를 주면 해결되지 않을까 싶네요.
얼룩돼지 (15,720 포인트) 님이 2013년 5월 1일 답변
껌돌이님이 2013년 5월 2일 채택됨
감사합니다!!!! 많은 도움 되었습니다
...