我正在使用的從AndroidDevelopers網站下列代碼行(http://developer.android.com/guide/topics/ui/layout/listview.html):Android的進度代碼似乎有錯誤
ProgressBar progressBar = new ProgressBar(this);
progressBar.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT, Gravity.CENTER));
progressBar.setIndeterminate(true);
getListView().setEmptyView(progressBar);
// Must add the progress bar to the root of the layout
ViewGroup root = (ViewGroup) findViewById(android.R.id.content);
root.addView(progressBar);
的代碼行,
progressBar.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT, Gravity.CENTER));
似乎有一個錯誤因爲沒有LayoutParams構造函數接受三個參數。我想讓我的進度條位於屏幕的中心。上述代碼是否有修正?