2011-12-02 136 views
1

雖然在我的手機上一切正常,但我在模擬器上運行時在我的應用程序中顯示TextView時存在一個小問題。我知道你們大多數人不會在意這一點,但我必須獲得我的應用程序的高質量屏幕截圖(這是我的畢業項目,我需要這些截屏以包含在項目文檔中)。Android模擬器沒有正確顯示TextView(在設備上正常工作)

那些在XML佈局文件中填充了一些值的TextViews正常顯示。但是,那些在用戶登錄後動態填充(來自Web服務的字符串值)僅部分顯示,例如只顯示上半部分,您可以在此屏幕截圖中看到它:

link to imageshack file with screenshot

正如我所提到的,我的設備(三星i5510)上的一切都非常好。 這些TextViews是TableLayout的一部分,每行(左列中的靜態標籤和右列中的動態值)。 XML佈局如下:

   <TableRow android:id="@+id/brandTableRow" android:layout_width="fill_parent" 
       android:layout_height="wrap_content" android:orientation="horizontal" 
       android:paddingBottom="2sp" android:paddingTop="2sp"> 
       <TextView android:id="@+id/brandLabel" android:layout_width="wrap_content" 
        android:layout_height="wrap_content" android:text="Model pojazdu:" 
        android:layout_column="1"> 
       </TextView> 
       <TextView android:id="@+id/brandTextView" 
        android:layout_width="wrap_content" android:layout_height="12px" 
        android:text="" android:gravity="right"> 
       </TextView> 
      </TableRow>    
      <TableRow android:id="@+id/widget67" android:layout_width="fill_parent" 
       android:layout_height="wrap_content" android:orientation="horizontal" 
       android:paddingBottom="2sp" android:paddingTop="2sp"> 
       <TextView android:id="@+id/widget40" android:layout_width="wrap_content" 
        android:layout_height="wrap_content" android:text="Ping:" 
        android:layout_column="1"> 
       </TextView> 
       <TextView android:id="@+id/pingTextView" 
        android:layout_width="wrap_content" android:layout_height="wrap_content" 
        android:text="n/a" android:gravity="right"> 
       </TextView> 
      </TableRow> 

我該如何解決這個問題?

+0

只需檢查AVD與您的設備匹配的屏幕分辨率/密度?如果不嘗試匹配這兩個,然後看看它的行爲。 – havexz

回答

0

這可能是因爲你對textviews的填充。

+0

謝謝,但它沒有奏效。該行的完全相同部分不可見。 – jackusz

+1

我在你的一篇Textiviews中看到你設置了textview的高度。嘗試縮小字體。它看起來很大。 –

+0

感謝隊友,它確實解決了這個問題。出於某種原因,我爲這些動態TextView編寫了「12px」高度硬編碼。更改爲「wrap_content」工作。我猜測仿真器與我的移動設備相比有不同的分辨率。 – jackusz

相關問題