2014-01-28 2 views
0

Android 개발에 익숙하지 않습니다. 나는 (안드로이드) 안드로이드 에뮬레이터에서 내 안드로이드 프로그램을 테스트했지만 큰 화면을 가지고있는 삼성 전화에서 동일한 프로그램을 실행할 때 타블렛에서 내 ImageView가 화면에 맞지 않습니다.Android ImageView가 큰 화면에 맞지 않습니다.

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context=".CompareActivity" > 

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

     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:adjustViewBounds="true" 
      android:src="@drawable/topbar" /> 

      <TabHost 
      android:id="@android:id/tabhost" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

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

       <TabWidget 
        android:id="@android:id/tabs" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:background="#160203" > 
       </TabWidget> 

       <FrameLayout 
        android:id="@android:id/tabcontent" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"/> 

      </LinearLayout> 

     </TabHost> 


      <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="0dp" > 

       <ImageView 
        android:id="@+id/imageView2" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:adjustViewBounds="true" 
        android:src="@drawable/crdt" /> 

       <ImageButton 
        android:id="@+id/registerbutton" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignParentRight="true" 
        android:layout_alignParentTop="true" 
        android:layout_marginRight="38dp" 
        android:layout_marginTop="15dp" 
        android:background="@android:color/transparent" 
        android:src="@drawable/green" /> 

       <ImageView 
        android:id="@+id/imageView3" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignParentLeft="true" 
        android:layout_below="@+id/imageView2" 
        android:adjustViewBounds="true" 
        android:src="@drawable/savings" /> 

       <ImageButton 
        android:id="@+id/blubutton" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignLeft="@+id/registerbutton" 
        android:layout_alignTop="@+id/imageView3" 
        android:layout_marginTop="18dp" 
        android:background="@android:color/transparent" 
        android:src="@drawable/blue" /> 

       <ImageView 
        android:id="@+id/imageView4" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignParentLeft="true" 
        android:layout_below="@+id/imageView3" 
        android:adjustViewBounds="true" 
        android:src="@drawable/pl" /> 

       <ImageButton 
        android:id="@+id/redbutton" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignLeft="@+id/blubutton" 
        android:layout_alignTop="@+id/imageView4" 
        android:layout_marginTop="17dp" 
        android:background="@android:color/transparent" 
        android:src="@drawable/red" /> 

       <ImageView 
        android:id="@+id/imageView5" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignParentLeft="true" 
        android:layout_below="@+id/imageView4" 
        android:adjustViewBounds="true" 
        android:src="@drawable/homlons" /> 

       <ImageView 
        android:id="@+id/imageView6" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignParentLeft="true" 
        android:layout_below="@+id/imageView5" 
        android:adjustViewBounds="true" 
        android:src="@drawable/fd" /> 

       <ImageButton 
        android:id="@+id/orbutton" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignLeft="@+id/redbutton" 
        android:layout_alignTop="@+id/imageView5" 
        android:layout_marginTop="26dp" 
        android:background="@android:color/transparent" 
        android:src="@drawable/orange" /> 

       <ImageButton 
        android:id="@+id/pubutton" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignLeft="@+id/orbutton" 
        android:layout_alignTop="@+id/imageView6" 
        android:layout_marginTop="18dp" 
        android:background="@android:color/transparent" 
        android:src="@drawable/purple" /> 

      </RelativeLayout> 

    </LinearLayout> 

</FrameLayout> 

+0

android : scaleType = "fitXY"를 ImageView에 설정하십시오. –

+0

어떤 이미지 뷰가 화면에 적합하지 않습니까? –

+0

@Amrola 두 ImageViews – Akunar

답변

0

사용 안드로이드 :

<ImageView 
    android:id="@+id/imageView2" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:adjustViewBounds="true" 
    android:scaleType="fitXY" 
android:src="@drawable/crdt" /> 

또는 코드로 변경 : 배경 =

0

"드로어 블/사진 절감 @"당신은 아래로 이미지 뷰의 XML을 변경할 수 있습니다 :

imageView.setScaleType(ScaleType.FIT_XY); 
1

레이아웃을 wrap content으로 설정하면 큰 화면에 빈 공간이 남습니다. 모든 공간을 차지하도록 레이아웃에 알립니다.

 <ImageView 
      android:id="@+id/imageView2" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:adjustViewBounds="true" 
      android:src="@drawable/crdt" /> 

     <ImageButton 
      android:id="@+id/greenbutton" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true" 
      android:layout_marginRight="38dp" 
      android:layout_marginTop="15dp" 
      android:background="@android:color/transparent" 
      android:src="@drawable/green" /> 

     <ImageView 
      android:id="@+id/imageView3" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_below="@+id/imageView2" 
      android:adjustViewBounds="true" 
      android:alignParentBottom="true" 
      android:src="@drawable/savings" /> 


    </RelativeLayout> 
관련 문제