2012-02-04 51 views
1

嗨,我正在做一個項目,並在其中使用ListView。我已經給它的代碼爲android2.1 ListView參考

<ListView android:id="@android:id/android:list" 
     android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
</ListView> 

我需要與上述名單的工作,我無法與

findViewById(@android:id/android/list); 

即使「R.id」來稱呼它不加工。

我應該使用OnClickListener()。

預先感謝您...

回答

1

試試這個它是有用的

<ListView 
    android:id="@+id/list" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" > 
</ListView> 

findViewById(R.id.list); 
4

正確的做法是:

getViewById(android.R.id.list); 
+1

另外,當不可在這個例子中,'@android:id/android:list'是'@android:id/list' 上班? – ninetwozero 2012-02-04 11:36:41