2011-10-24 2 views
0

Android 앱을 개발 중입니다 (스크린 샷 참조).Android보기 특정 지점 아래로 잘림

그래픽 편집기에서 모양이 좋아 보입니다. 그러나 앱이 에뮬레이터에서 실행될 때뿐만 아니라 Android 휴대 전화에서도 화면 하단 1/4이 잘립니다. 이 앱에는 여러 가지 활동이 있으며 문제는 모든 사람에게 널리 퍼져있는 것처럼 보입니다.

The view from my eclipse editor The view from my android emulator

여기 내가 사용 레이아웃입니다.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout android:layout_width="fill_parent" 
    xmlns:android="http://schemas.android.com/apk/res/android" android:clipChildren="false" android:clipToPadding="false" android:layout_height="fill_parent"> 
    <ImageView android:layout_height="wrap_content" android:src="@drawable/simpsonstextblack" android:layout_width="fill_parent" android:id="@+id/TitleImage" android:paddingBottom="25dp"></ImageView> 
    <RelativeLayout android:layout_below="@+id/TitleImage" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/RelativeLayout1" android:padding="5dp"> 
     <Button android:text="Take the Simpsons Challenge" android:gravity="center" android:clickable="true" android:id="@+id/ChallengeButton" android:layout_width="fill_parent" android:textSize="20dp" android:background="@drawable/buttonbackgroundblue" android:layout_height="50dp"></Button> 
     <TextView android:layout_width="fill_parent" android:layout_below="@+id/ChallengeButton" android:layout_alignLeft="@+id/ChallengeButton" android:id="@+id/spacer1" android:layout_height="6dp"></TextView> 
     <Button android:layout_width="fill_parent" android:text="Free Play" android:clickable="true" android:id="@+id/FreePlayButton" android:layout_height="50dp" android:textSize="20dp" android:background="@drawable/buttonbackgroundblue" android:layout_below="@+id/spacer1"></Button> 
     <TextView android:layout_width="fill_parent" android:id="@+id/spacer2" android:layout_below="@+id/FreePlayButton" android:layout_alignLeft="@+id/FreePlayButton" android:layout_height="6dp"></TextView> 
     <Button android:layout_height="50dp" android:textSize="20dp" android:id="@+id/HighScoreButton" android:background="@drawable/buttonbackgroundblue" android:layout_width="fill_parent" android:text="High Scores" android:layout_below="@+id/spacer2"></Button> 
     <TextView android:layout_width="fill_parent" android:id="@+id/spacer3" android:layout_below="@+id/HighScoreButton" android:layout_alignLeft="@+id/HighScoreButton" android:layout_height="6dp"></TextView> 
     <Button android:layout_height="50dp" android:textSize="20dp" android:id="@+id/HelpButton" android:background="@drawable/buttonbackgroundblue" android:layout_width="fill_parent" android:text="Help" android:layout_below="@+id/spacer3"></Button> 
    </RelativeLayout> 
    <RelativeLayout android:layout_below="@+id/RelativeLayout1" android:layout_width="fill_parent" android:id="@+id/RelativeLayout2" android:clipChildren="false" android:clipToPadding="false" android:layout_height="fill_parent"> 
     <TextView android:id="@+id/spacer1" android:layout_width="fill_parent" android:layout_height="30dp"></TextView> 
     <TextView android:layout_below="@+id/spacer1" android:layout_height="wrap_content" android:layout_width="fill_parent" android:textAppearance="?android:attr/textAppearanceMedium" android:id="@+id/QuoteText" android:text='"A woman is a lot like a refrigerator. Six feet tall, 300 pounds…it makes ice. Heres some extra filler text just to demonstrate to you that if you add enough text it will most likely get clipped at some random point in the screen seemingly for no reason."'></TextView> 
    </RelativeLayout> 
</RelativeLayout> 
+0

장치에서이 문제를 재현 할 수 없습니다. 귀하의 장치에서 실행하면 그것은 에뮬레이터와 동일한 것을 보여줍니까? – Craigy

+0

예, 스크린 샷은 에뮬레이터 자체에서 가져온 것입니다. 아래쪽 텍스트 뷰에 몇 줄의 텍스트를 추가하고 잘라내는지 확인하십시오. – Allen

+0

내가 말한 것은 에뮬레이터에서 작동해야하지만 실제로는 에뮬레이터가 아닌 실제 장치에서 제대로 작동 할 수 있다는 것입니다. 그냥 그 가능성을 배제하려고합니다. 화면 아래쪽으로 스크롤 할만큼 충분한 텍스트 줄을 추가했지만 장치의 화면 가장자리에서만 클립을 만듭니다. – Craigy

답변

2

내 생각에 앱이 호환 모드로 실행됩니다. 매니페스트에 다음과 같이 설정하십시오 :

<supports-screens android:smallScreens="true" 
    android:normalScreens="true" 
    android:largeScreens="true" 
    android:anyDensity="true" /> 

을 당신이 여기에 대한 자세한 내용을보실 수 있습니다 문제의 경우 : http://developer.android.com/guide/topics/manifest/supports-screens-element.html가. 짧은 안드로이드 : largeScreens 기본값은 accros 버전에 따라 다릅니다. :)

1

문제는 마지막 텍스트 뷰 (@+id/QuoteText가) android:visibility="invisible"로 설정되어 있다는 점이다. 이것은 내용이 보이지 않지만 공간을 차지한다는 것을 의미합니다. 대신 android:visibility="gone"을 사용하려고합니다.

이전에 휴대 전화에서 제대로 작동하지 않았다는 사과를드립니다. 내 장치에서 텍스트가 화면 하단에 도달하지 않았기 때문에 맨 위에있는 ImageView에 공간을 추가했지만 텍스트를 화면 밖으로 차단하는 TextView를 밀어 넣었습니다. 희망이 도움이!

편집 : 중 문제가 아니었다

. 문제는 아래쪽 RelativeLayout이

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:id="@+id/RelativeLayout1" 
    android:layout_height="200dp"> 

으로 정의되어 있으며 하단 패널의 높이가 고정되어 있다고 생각합니다. android:layout_height="200dp"android:layout_height="fill_parent"으로 변경하면 클리핑 문제가 사라집니다. 아마도 다른 활동에 대해서도 같은 문제가 있습니까?

레이아웃이 작동하지 않는 이유는 모르겠지만 RelativeLayouts 대신 LinearLayouts를 사용하면 더 쉽고 효율적으로 동일한 작업을 수행 할 수 있다고 생각합니다. 그리고 아마 당신의 문제를 해결할 것입니다. 스페이서 뷰를 사용하는 대신 패딩을 사용하는 것이 더 좋습니다. 내 뜻은 다음과 같습니다.

<?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:orientation="vertical" > 

    <ImageView 
     android:id="@+id/TitleImage" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:scaleType="fitStart" 
     android:src="@drawable/simpsonstextblack" > 
    </ImageView> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/TitleImage" 
     android:orientation="vertical" 
     android:padding="5dp" > 

     <Button 
      android:id="@+id/ChallengeButton" 
      android:layout_width="fill_parent" 
      android:layout_height="50dp" 
      android:clickable="true" 
      android:paddingLeft="6dp" 
      android:paddingRight="6dp" 
      android:text="Take the Simpsons Challenge" 
      android:textSize="20dp" > 
     </Button> 

     <Button 
      android:id="@+id/FreePlayButton" 
      android:layout_width="fill_parent" 
      android:layout_height="50dp" 
      android:clickable="true" 
      android:paddingLeft="6dp" 
      android:paddingRight="6dp" 
      android:text="Free Play" 
      android:textSize="20dp" > 
     </Button> 

     <Button 
      android:id="@+id/HighScoreButton" 
      android:layout_width="fill_parent" 
      android:layout_height="50dp" 
      android:paddingLeft="6dp" 
      android:paddingRight="6dp" 
      android:text="High Scores" 
      android:textSize="20dp" > 
     </Button> 

     <Button 
      android:id="@+id/HelpButton" 
      android:layout_width="fill_parent" 
      android:layout_height="50dp" 
      android:paddingLeft="6dp" 
      android:paddingRight="6dp" 
      android:text="Help" 
      android:textSize="20dp" > 
     </Button> 
    </LinearLayout> 

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

     <TextView 
      android:id="@+id/QuoteText" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:paddingTop="30dp" 
      android:text="&quot;A woman is a lot like a refrigerator. Six feet tall, 300 pounds…it makes ice. Heres some extra filler text just to demonstrate to you that if you add enough text it will most likely get clipped at some random point in the screen seemingly for no reason. &quot;" 
      android:textAppearance="?android:attr/textAppearanceMedium" /> 
    </LinearLayout> 
</LinearLayout> 
+0

나는 textview가 보이지 않는다는 것을 알고 있습니다. 나는 그것을 꺼내야 만했지만 문제가되지는 않습니다 (스크린을 75 % 클리핑하고 견적 텍스트를 닫습니다). 문제는 응용 프로그램의 모든 활동에 널리 퍼져 있습니다. 문제가 아마도 개별보기 요소가 아닙니다. – Allen

+0

정확하고 문제가 아닙니다. 내 대답을 편집하여 도움이되는지 확인하십시오. – Craigy

+0

효과가 없어도 여전히 잘립니다. – Allen