2011-10-23 291 views
0

我正在开发一个Android应用程序(请参阅屏幕截图)。Android屏幕截图底部

我有一个在图形编辑器中看起来很好的布局。但是,当应用程序在仿真器中运行时,屏幕的底部1/4将从视图剪辑。该应用程序有几个活动,这个问题似乎是普遍的。

View from Eclipse gui builder View from the android emulator/actual phone

模拟器目标是Android 2.3的,问题也出现了2.2手机上。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout android:layout_width="fill_parent" 
    android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android" 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:layout_gravity="center_horizontal" android:paddingBottom="20dp"></ImageView> 
    <RelativeLayout 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:layout_height="50dp" android:textSize="20dp" android:background="@drawable/buttonbackgroundblue"></Button> 
     <TextView android:layout_width="fill_parent" android:layout_below="@+id/ChallengeButton" android:layout_alignLeft="@+id/ChallengeButton" android:id="@+id/spacer1" android:layout_height="5dp"></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="5dp"></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="5dp"></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_width="fill_parent" android:id="@+id/RelativeLayout1" android:layout_height="fill_parent"> 
     <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="50dp"></TextView> 
     <TextView android:layout_below="@+id/textView1" 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."'></TextView> 
     <TextView android:layout_below="@+id/QuoteText" android:layout_width="fill_parent" android:id="@+id/QuoteTextSpeaker" android:gravity="right" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_height="wrap_content" android:text=" - Homer"></TextView> 
    </RelativeLayout> 
</LinearLayout> 

谢谢

+1

你可以发布布局文件吗? – 500865

+0

布局在那里。 – Allen

回答

1

我一直在瞄准SDK 3,当它应该是4.显然瞄准SDK 3导致android剪辑屏幕,如果它过度,而不是收缩它适合。

0

你不应该使用内其他LinearLayout这么多假LinearLayout秒。您需要使用RelativeLayout这些视图。

+0

我知道,毫无疑问,一个可怕的解决方案。转换为relativelayout是否可以解决问题?我的意思是,我正在修复这些虚拟布局的大小。我只是不明白为什么我的屏幕底部1/4被剪辑。但我可以尝试。 – Allen

+0

我相信会。你需要看看这个:http://stackoverflow.com/questions/2961049/effective-android-programming-techniques/3020898#3020898。项目#3是我所想要的。 – 500865

+0

我将布局更改为相对布局,并用空文本视图替换了线性布局间隔符。但是,问题仍然完全如屏幕截图所示。我没有看到RelativeLayouts与从视图剪辑的屏幕的底部1/4有什么关系。 – Allen