2010-09-24 103 views
0

我正在編寫我的第一個簡單的Android應用程序:它從基於Java的測量系統(CSV通過HTTP)加載溫度樣本,顯示Spinner中的可用通道以及選擇通道時,它在兩個TextView中顯示相應的值和時間戳。該應用程序工作正常,除了一個小化妝品問題:下拉列表中的項目由水平線(分隔線)分隔,並根據滾動位置,一些線條消失並再次出現,當我滾動一些更多的像素或下。該現象發生在模擬器屏幕上以及手持顯示器(HTC Wildfire)上。似乎是一個屏幕解決問題。有沒有人有提示如何避免這種情況?請參閱下面我的代碼...Spinner下拉列表中消失的分隔線

感謝, gemue

public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    loadData(); 
    setContentView(R.layout.main); 
    Spinner spinner = (Spinner) findViewById(R.id.Spinner01); 
    ArrayAdapter adapter = new ArrayAdapter(this, 
      android.R.layout.simple_spinner_dropdown_item, channels); 
    spinner.setAdapter(adapter); 
    spinner.setOnItemSelectedListener(new SelectListener()); 
} 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:orientation="vertical" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 
    <Spinner android:id="@+id/Spinner01" 
      android:layout_height="wrap_content" 
      android:layout_width="fill_parent" 
      android:layout_margin="15px"/> 
    <TextView android:text="@+id/TextView01" android:id="@+id/TextView01" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_below="@+id/Spinner01" 
      android:textSize="40sp" android:textStyle="bold" 
      android:layout_margin="15sp"/> 
    <TextView android:text="@+id/TextView02" android:id="@+id/TextView02" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_below="@+id/TextView01"/> 
</RelativeLayout> 

回答

1

只是檢查這是否會解決這一問題。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"> 
    <supports-screens 
    android:largeScreens="false" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true" /> 
</manifest> 
+0

是的,就是這樣!我永遠不會期望在清單中解決它。也許我應該花更多時間閱讀文檔;-)非常感謝! – gemue 2010-09-26 09:03:42