Code example for ActionBar.LayoutParams

0
super.onCreate(savedInstanceState);
 
// Create a progress bar to display while the list loads 
ProgressBar progressBar = new ProgressBar(this);
progressBar.setLayoutParams(new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
        android.view.ViewGroup.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);
 
// For the cursor adapter, specify which columns go into which views 
String[] fromColumns = {ContactsContract.Data.DISPLAY_NAME};
int[] toViews = {android.R.id.text1}; // The TextView in simple_list_item_1
 
// Create an empty adapter we will use to display the loaded data. 
// We pass null for the cursor, then update it in onLoadFinished() 
mAdapter = new SimpleCursorAdapter(this, 
        android.R.layout.simple_list_item_1, null,