2011-10-23 197 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