0

我試圖使用textView來顯示文本框。我在運行時添加了一些數據。我只想讓它顯示一個23號線的盒子。模擬器中顯示的佈局與實際設備中顯示的佈局不同

正在使用的代碼是這樣的。

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

     <TextView 
      android:id="@+id/twittertext" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:fadingEdge="vertical" 
      android:maxLines="23" 
      android:minLines="23" 
      android:background="@drawable/dropshadow" 
      android:scrollbars="vertical" 
      android:text="Getting data on your slow n/w..." 
      android:textColor="#ffffff" 
      /> 
    </ScrollView> 
</LinearLayout> 

現在,當我看到這個模擬器它的到來完美(Android 2.2的),但是當我在真實設備(野火2.2.1)測試相同的代碼框不來了23行。相反,它只是顯示一個5線盒子。我能夠滾動,但看起來像

:minLine

不工作。

請幫幫我。

+0

您確定在Eclipse中的佈局編輯器中,您已將目標設置爲Android 2.2? –

回答

0

好的。我沒有答案。但這就是我解決問題的方法,以防萬一別人需要它。

我已經使用了屏幕像素,然後計算了我需要的視圖像素。然後添加相同的

android:layout_height 

財產和它爲我工作。