Search in sources :

Example 1 with Spinner

use of org.holoeverywhere.widget.Spinner in project HoloEverywhere by Prototik.

the class ActionBarView method setNavigationMode.

public void setNavigationMode(int mode) {
    final int oldMode = mNavigationMode;
    if (mode != oldMode) {
        switch(oldMode) {
            case ActionBar.NAVIGATION_MODE_LIST:
                if (mListNavLayout != null) {
                    removeView(mListNavLayout);
                }
                break;
            case ActionBar.NAVIGATION_MODE_TABS:
                if (mTabScrollView != null && mIncludeTabs) {
                    removeView(mTabScrollView);
                }
        }
        switch(mode) {
            case ActionBar.NAVIGATION_MODE_LIST:
                if (mSpinner == null) {
                    mSpinner = new Spinner(mContext, null, R.attr.actionDropDownStyle);
                    mListNavLayout = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.abc_action_bar_view_list_nav_layout, null);
                    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT);
                    params.gravity = Gravity.CENTER;
                    mListNavLayout.addView(mSpinner, params);
                }
                if (mSpinner.getAdapter() != mSpinnerAdapter) {
                    mSpinner.setAdapter(mSpinnerAdapter);
                }
                mSpinner.setOnItemSelectedListener(mNavItemSelectedListener);
                addView(mListNavLayout);
                break;
            case ActionBar.NAVIGATION_MODE_TABS:
                if (mTabScrollView != null && mIncludeTabs) {
                    addView(mTabScrollView);
                }
                break;
        }
        mNavigationMode = mode;
        requestLayout();
    }
}
Also used : Spinner(org.holoeverywhere.widget.Spinner) LinearLayout(org.holoeverywhere.widget.LinearLayout)

Example 2 with Spinner

use of org.holoeverywhere.widget.Spinner in project HoloEverywhere by Prototik.

the class ScrollingTabContainerView method createSpinner.

private Spinner createSpinner() {
    final Spinner spinner = new Spinner(getContext(), null, R.attr.actionDropDownStyle);
    spinner.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.FILL_PARENT));
    spinner.internalSetOnItemClickListener(this);
    return spinner;
}
Also used : Spinner(org.holoeverywhere.widget.Spinner) LinearLayout(org.holoeverywhere.widget.LinearLayout)

Aggregations

LinearLayout (org.holoeverywhere.widget.LinearLayout)2 Spinner (org.holoeverywhere.widget.Spinner)2