Example usage for android.widget LinearLayout setOrientation

List of usage examples for android.widget LinearLayout setOrientation

Introduction

In this page you can find the example usage for android.widget LinearLayout setOrientation.

Prototype

public void setOrientation(@OrientationMode int orientation) 

Source Link

Document

Should the layout be a column or a row.

Usage

From source file:org.mariotaku.twidere.fragment.BasePullToRefreshListFragment.java

/**
 * Provide default implementation to return a simple list view. Subclasses
 * can override to replace with their own layout. If doing so, the returned
 * view hierarchy <em>must</em> have a ListView whose id is
 * {@link android.R.id#list android.R.id.list} and can optionally have a
 * sibling view id {@link android.R.id#empty android.R.id.empty} that is to
 * be shown when the list is empty./*w  ww  . j ava 2 s . c o  m*/
 * 
 * <p>
 * If you are overriding this method with your own custom content, consider
 * including the standard layout {@link android.R.layout#list_content} in
 * your layout file, so that you continue to retain all of the standard
 * behavior of ListFragment. In particular, this is currently the only way
 * to have the built-in indeterminant progress state be shown.
 */
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    final Context context = getActivity();

    final FrameLayout root = new FrameLayout(context);

    // ------------------------------------------------------------------

    final LinearLayout pframe = new LinearLayout(context);
    pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
    pframe.setOrientation(LinearLayout.VERTICAL);
    pframe.setVisibility(View.GONE);
    pframe.setGravity(Gravity.CENTER);

    final ProgressBar progress = new HoloProgressBar(context, null, android.R.attr.progressBarStyleLarge);
    pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // ------------------------------------------------------------------

    final FrameLayout lframe = new FrameLayout(context);
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);

    final TextView tv = new TextView(getActivity());
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(Gravity.CENTER);
    lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    final PullToRefreshListView plv = new PullToRefreshListView(context);
    plv.setOnRefreshListener(this);
    plv.setShowIndicator(false);
    plv.setOnPullEventListener(new AccessibilityPullEventListener<ListView>(context));
    plv.setPullToRefreshOverScrollEnabled(false);
    mPullToRefreshListView = plv;

    final ListView lv = plv.getRefreshableView();
    lv.setId(android.R.id.list);
    lv.setDrawSelectorOnTop(false);
    // ViewCompat.setOverScrollMode(lv, ViewCompat.OVER_SCROLL_NEVER);
    lframe.addView(plv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // ------------------------------------------------------------------

    root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    return root;
}

From source file:org.thialfihar.android.apg.ui.SelectPublicKeyFragment.java

/**
 * Copied from ListFragment and added EditText for search on top of list.
 * We do not use a custom layout here, because this breaks the progress bar functionality
 * of ListFragment./*w w w.  jav a2 s . c  om*/
 *
 * @param inflater
 * @param container
 * @param savedInstanceState
 * @return
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = getActivity();

    FrameLayout root = new FrameLayout(context);

    // ------------------------------------------------------------------

    LinearLayout pframe = new LinearLayout(context);
    pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
    pframe.setOrientation(LinearLayout.VERTICAL);
    pframe.setVisibility(View.GONE);
    pframe.setGravity(Gravity.CENTER);

    ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge);
    pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    // ------------------------------------------------------------------

    FrameLayout lframe = new FrameLayout(context);
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);

    TextView tv = new TextView(getActivity());
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(Gravity.CENTER);
    lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    // Added for search view: linearLayout, mSearchView
    LinearLayout linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.VERTICAL);

    mSearchView = new EditText(context);
    mSearchView.setId(SEARCH_ID);
    mSearchView.setHint(R.string.menu_search);
    mSearchView.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.ic_action_search),
            null, null, null);

    linearLayout.addView(mSearchView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    ListView lv = new ListView(getActivity());
    lv.setId(android.R.id.list);
    lv.setDrawSelectorOnTop(false);
    linearLayout.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    lframe.addView(linearLayout, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    // ------------------------------------------------------------------

    root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    return root;
}

From source file:br.org.funcate.dynamicforms.views.GTimeView.java

/**
 * @param fragment the fragment.//from  www. j a v  a2  s .c  om
 * @param attrs attributes.
 * @param parentView parent
 * @param label label
 * @param value value
 * @param constraintDescription constraints
 * @param readonly if <code>false</code>, the item is disabled for editing.
 */
public GTimeView(final Fragment fragment, AttributeSet attrs, LinearLayout parentView, String label,
        String value, String constraintDescription, boolean readonly) {
    super(fragment.getActivity(), attrs);

    final Context context = fragment.getActivity();

    LinearLayout textLayout = new LinearLayout(context);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(10, 10, 10, 10);
    textLayout.setLayoutParams(layoutParams);
    textLayout.setOrientation(LinearLayout.VERTICAL);
    parentView.addView(textLayout);

    TextView textView = new TextView(context);
    textView.setLayoutParams(
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    textView.setPadding(2, 2, 2, 2);
    textView.setText(label.replace(UNDERSCORE, " ").replace(COLON, " ") + " " + constraintDescription);
    textView.setTextColor(context.getResources().getColor(R.color.formcolor));
    textLayout.addView(textView);

    button = new Button(context);
    button.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    button.setPadding(15, 5, 15, 5);

    final SimpleDateFormat timeFormatter = TimeUtilities.INSTANCE.TIMEONLY_FORMATTER;
    if (value == null || value.length() == 0) {
        String dateStr = timeFormatter.format(new Date());
        button.setText(dateStr);
    } else {
        button.setText(value);
    }
    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            String dateStr = button.getText().toString();
            Date date = null;
            try {
                date = timeFormatter.parse(dateStr);
            } catch (ParseException e) {
                //GPLog.error(this, null, e);
                Toast.makeText(context, e.getMessage(), Toast.LENGTH_LONG).show();
                // fallback on current date
                date = new Date();
            }
            final Calendar c = Calendar.getInstance();
            c.setTime(date);
            int hourOfDay = c.get(Calendar.HOUR_OF_DAY);
            int minute = c.get(Calendar.MINUTE);

            FormTimePickerFragment newFragment = new FormTimePickerFragment();
            newFragment.setAttributes(hourOfDay, minute, true, button);
            //newFragment.show(fragment.getFragmentManager(), "timePicker");
        }
    });
    button.setEnabled(!readonly);

    textLayout.addView(button);
}

From source file:org.mozilla.gecko.GeckoPreferences.java

protected Dialog onCreateDialog(int id) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    LinearLayout linearLayout = new LinearLayout(this);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    AlertDialog dialog = null;//from w  w w .  ja va 2  s.c  om
    switch (id) {
    case DIALOG_CREATE_MASTER_PASSWORD:
        final EditText input1 = getTextBox(R.string.masterpassword_password);
        final EditText input2 = getTextBox(R.string.masterpassword_confirm);
        linearLayout.addView(input1);
        linearLayout.addView(input2);

        builder.setTitle(R.string.masterpassword_create_title).setView((View) linearLayout)
                .setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        JSONObject jsonPref = new JSONObject();
                        try {
                            jsonPref.put("name", "privacy.masterpassword.enabled");
                            jsonPref.put("type", "string");
                            jsonPref.put("value", input1.getText().toString());

                            GeckoEvent event = GeckoEvent.createBroadcastEvent("Preferences:Set",
                                    jsonPref.toString());
                            GeckoAppShell.sendEventToGecko(event);
                        } catch (Exception ex) {
                            Log.e(LOGTAG, "Error setting masterpassword", ex);
                        }
                        return;
                    }
                }).setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        return;
                    }
                });
        dialog = builder.create();
        dialog.setOnShowListener(new DialogInterface.OnShowListener() {
            public void onShow(DialogInterface dialog) {
                input1.setText("");
                input2.setText("");
                input1.requestFocus();
            }
        });

        PasswordTextWatcher watcher = new PasswordTextWatcher(input1, input2, dialog);
        input1.addTextChangedListener((TextWatcher) watcher);
        input2.addTextChangedListener((TextWatcher) watcher);

        break;
    case DIALOG_REMOVE_MASTER_PASSWORD:
        final EditText input = getTextBox(R.string.masterpassword_password);
        linearLayout.addView(input);

        builder.setTitle(R.string.masterpassword_remove_title).setView((View) linearLayout)
                .setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        try {
                            JSONObject jsonPref = new JSONObject();
                            jsonPref.put("name", "privacy.masterpassword.enabled");
                            jsonPref.put("type", "string");
                            jsonPref.put("value", input.getText().toString());

                            GeckoEvent event = GeckoEvent.createBroadcastEvent("Preferences:Set",
                                    jsonPref.toString());
                            GeckoAppShell.sendEventToGecko(event);
                        } catch (Exception ex) {
                            Log.e(LOGTAG, "Error setting masterpassword", ex);
                        }
                        return;
                    }
                }).setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        return;
                    }
                });
        dialog = builder.create();
        dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
            public void onDismiss(DialogInterface dialog) {
                input.setText("");
            }
        });
        break;
    default:
        return null;
    }

    return dialog;
}

From source file:br.org.funcate.dynamicforms.views.GDateView.java

/**
 * @param fragment   the fragment to use.
 * @param attrs attributes.//from  w  ww . j ava  2s  .  c  o m
 * @param parentView parent
 * @param label label
 * @param value value
 * @param constraintDescription constraints
 * @param readonly if <code>false</code>, the item is disabled for editing.
 */
public GDateView(final Fragment fragment, AttributeSet attrs, LinearLayout parentView, String label,
        String value, String constraintDescription, boolean readonly) {
    super(fragment.getActivity(), attrs);

    final Context context = fragment.getActivity();

    LinearLayout textLayout = new LinearLayout(context);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(10, 10, 10, 10);
    textLayout.setLayoutParams(layoutParams);
    textLayout.setOrientation(LinearLayout.VERTICAL);
    parentView.addView(textLayout);

    TextView textView = new TextView(context);
    textView.setLayoutParams(
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    textView.setPadding(2, 2, 2, 2);
    textView.setText(label.replace(UNDERSCORE, " ").replace(COLON, " ") + " " + constraintDescription);
    textView.setTextColor(context.getResources().getColor(R.color.formcolor));
    textLayout.addView(textView);

    button = new Button(context);
    button.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    button.setPadding(15, 5, 15, 5);

    final SimpleDateFormat dateFormatter = TimeUtilities.INSTANCE.DATEONLY_FORMATTER;
    if (value == null || value.length() == 0) {
        String dateStr = dateFormatter.format(new Date());
        button.setText(dateStr);
    } else {
        button.setText(value);
    }
    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            String dateStr = button.getText().toString();
            Date date = null;
            try {
                date = dateFormatter.parse(dateStr);
            } catch (ParseException e) {
                //GPLog.error(this, null, e);
                Toast.makeText(context, e.getMessage(), Toast.LENGTH_LONG).show();
                date = new Date();
            }
            final Calendar c = Calendar.getInstance();
            c.setTime(date);
            int year = c.get(Calendar.YEAR);
            int month = c.get(Calendar.MONTH);
            int day = c.get(Calendar.DAY_OF_MONTH);

            FormDatePickerFragment newFragment = new FormDatePickerFragment();
            newFragment.setAttributes(year, month, day, button);
            newFragment.show(fragment.getFragmentManager(), "datePicker");
        }
    });
    button.setEnabled(!readonly);

    textLayout.addView(button);
}

From source file:hotstu.github.bdzviewer.ui.CustomListFragment.java

/**
 * Provide default implementation to return a simple list view.  Subclasses
 * can override to replace with their own layout.  If doing so, the
 * returned view hierarchy <em>must</em> have a ListView whose id
 * is {@link android.R.id#list android.R.id.list} and can optionally
 * have a sibling view id {@link android.R.id#empty android.R.id.empty}
 * that is to be shown when the list is empty.
 * //from   ww  w.java  2  s  . c  o  m
 * <p>If you are overriding this method with your own custom content,
 * consider including the standard layout {@link android.R.layout#list_content}
 * in your layout file, so that you continue to retain all of the standard
 * behavior of ListFragment.  In particular, this is currently the only
 * way to have the built-in indeterminant progress state be shown.
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = getActivity();

    FrameLayout root = new FrameLayout(context);

    // ------------------------------------------------------------------

    LinearLayout pframe = new LinearLayout(context);
    pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
    pframe.setOrientation(LinearLayout.VERTICAL);
    pframe.setVisibility(View.GONE);
    pframe.setGravity(Gravity.CENTER);

    ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge);
    pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    // ------------------------------------------------------------------

    FrameLayout lframe = new FrameLayout(context);
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);

    TextView tv = new TextView(getActivity());
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(Gravity.CENTER);
    lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    ListView lv = new ListView(getActivity());
    lv.setId(android.R.id.list);
    lv.setDrawSelectorOnTop(false);
    lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    // ------------------------------------------------------------------

    root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    return root;
}

From source file:utils.widget.vpi_lib.TabPageIndicator_Custom.java

@SuppressLint("InflateParams")
private void addTab(int index, CharSequence text, int iconResId, String url) {
    // TODO/*from w ww. j av a2s . co  m*/
    final TabView tabView = new TabView(getContext());
    tabView.mIndex = index;
    LinearLayout linearLayout = new LinearLayout(getContext());
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setTag(index);
    linearLayout.setFocusable(true);
    linearLayout.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            LinearLayout tabView = (LinearLayout) v;
            final int oldSelected = mViewPager.getCurrentItem();
            final int newSelected = Integer.valueOf(tabView.getTag().toString());
            mViewPager.setCurrentItem(newSelected);
            if (oldSelected == newSelected && mTabReselectedListener != null) {
                mTabReselectedListener.onTabReselected(newSelected);
            }
        }
    });

    parentView = LayoutInflater.from(getContext()).inflate(R.layout.vpi_tap_custom, null);
    ImageView img = (ImageView) parentView.findViewById(R.id.tabImage);
    // img.setImageResource(iconResId);
    /*
     * ProgressBar pbBar = (ProgressBar)
     * view.findViewById(R.id.progressBar_tab_custom);
     */
    // LinearLayout layout = (LinearLayout)
    // view.findViewById(R.id.vpi_custom_layout);
    TextView txtTitle = (TextView) parentView.findViewById(R.id.vpi_custom_txt_Title);
    TextView txtBottom = (TextView) parentView.findViewById(R.id.vpi_custom_txt_btm);
    // TODO
    // LinearLayout.LayoutParams layoutParams = new
    // LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    // layout.setLayoutParams(layoutParams);

    txtTitle.setText(text);
    txtTitle.setTextColor(getResources().getColor(R.color.vpi_non_focus));
    txtBottom.setBackgroundColor(getResources().getColor(R.color.vpi_non_focus));

    /*
     * AQuery aq = new AQuery(getContext());
     * aq.id(img).progress(pbBar).image(url, false, true, 0,
     * R.drawable.img_default_category, new BitmapAjaxCallback() {
     * 
     * @SuppressLint("NewApi") @SuppressWarnings("deprecation")
     * 
     * @Override protected void callback(String url, ImageView iv, Bitmap
     * bm, AjaxStatus status) { int sdk = android.os.Build.VERSION.SDK_INT;
     * if(sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
     * iv.setBackgroundDrawable(new
     * BitmapDrawable(getContext().getResources(), bm)); } else {
     * iv.setBackground(new BitmapDrawable(getContext().getResources(),
     * bm)); } } });
     */

    linearLayout.addView(parentView);
    linearLayout.addView(tabView);

    mTabLayout.addView(linearLayout, new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT, 1));
}

From source file:com.krayzk9s.imgurholo.ui.MessagingFragment.java

private void buildSendMessage(String username) {
    ImgurHoloActivity activity = (ImgurHoloActivity) getActivity();
    final EditText newUsername = new EditText(activity);
    newUsername.setSingleLine();//from   ww w.  j av  a  2s  .com
    newUsername.setHint(R.string.body_hint_recipient);
    if (username != null)
        newUsername.setText(username);
    final EditText newBody = new EditText(activity);
    newBody.setHint(R.string.body_hint_body);
    newBody.setLines(5);
    LinearLayout linearLayout = new LinearLayout(activity);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.addView(newUsername);
    linearLayout.addView(newBody);
    new AlertDialog.Builder(activity).setTitle(R.string.dialog_send_message_title).setView(linearLayout)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    MessagingAsync messagingAsync = new MessagingAsync(newBody.getText().toString(),
                            newUsername.getText().toString());
                    messagingAsync.execute();

                }
            }).setNegativeButton(R.string.dialog_answer_cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    // Do nothing.
                }
            }).show();
}

From source file:com.polyvi.xface.extension.inappbrowser.XInAppBrowser.java

/**
 * ??Dialog/*from w  ww.j av a 2  s  .c  o m*/
 * @param layout ?
 * @return
 */
protected LinearLayout createMainContainerLayout(int layout) {
    LinearLayout mainLayout = new LinearLayout(mContext);
    mainLayout.setOrientation(layout);
    return mainLayout;
}

From source file:com.frostwire.android.gui.views.ExpandableListFragment.java

/**
 * Provide default implementation to return a simple list view.  Subclasses
 * can override to replace with their own layout.  If doing so, the
 * returned view hierarchy <em>must</em> have a ListView whose id
 * is {@link android.R.id#list android.R.id.list} and can optionally
 * have a sibling view id {@link android.R.id#empty android.R.id.empty}
 * that is to be shown when the list is empty.
 * //from www .  j a va  2s.  c o  m
 * <p>If you are overriding this method with your own custom content,
 * consider including the standard layout {@link android.R.layout#list_content}
 * in your layout file, so that you continue to retain all of the standard
 * behavior of ListFragment.  In particular, this is currently the only
 * way to have the built-in indeterminant progress state be shown.
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = getActivity();

    FrameLayout root = new FrameLayout(context);

    // ------------------------------------------------------------------

    LinearLayout pframe = new LinearLayout(context);
    pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
    pframe.setOrientation(LinearLayout.VERTICAL);
    pframe.setVisibility(View.GONE);
    pframe.setGravity(Gravity.CENTER);

    ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge);
    pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    // ------------------------------------------------------------------

    FrameLayout lframe = new FrameLayout(context);
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);

    TextView tv = new TextView(getActivity());
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(Gravity.CENTER);
    lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    ExpandableListView lv = new ExpandableListView(getActivity());
    lv.setId(android.R.id.list);
    lv.setDrawSelectorOnTop(false);
    lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    // ------------------------------------------------------------------

    root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT));

    return root;
}