当前位置: 首页>>代码示例>>Java>>正文


Java ActionBar类代码示例

本文整理汇总了Java中com.actionbarsherlock.app.ActionBar的典型用法代码示例。如果您正苦于以下问题:Java ActionBar类的具体用法?Java ActionBar怎么用?Java ActionBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ActionBar类属于com.actionbarsherlock.app包,在下文中一共展示了ActionBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onTabReselected

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
@Override
public void onTabReselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
    if (mListener != null) {
        FragmentTransaction trans = null;
        if (mActivity instanceof FragmentActivity) {
            trans = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
                    .disallowAddToBackStack();
        }

        mListener.onTabReselected(this, trans);

        if (trans != null && !trans.isEmpty()) {
            trans.commit();
        }
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:17,代码来源:ActionBarWrapper.java

示例2: onTabSelected

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
@Override
public void onTabSelected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
    if (mListener != null) {

        if (mFragmentTransaction == null && mActivity instanceof FragmentActivity) {
            mFragmentTransaction = ((FragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
                    .disallowAddToBackStack();
        }

        mListener.onTabSelected(this, mFragmentTransaction);

        if (mFragmentTransaction != null) {
            if (!mFragmentTransaction.isEmpty()) {
                mFragmentTransaction.commit();
            }
            mFragmentTransaction = null;
        }
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:20,代码来源:ActionBarWrapper.java

示例3: createTabView

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
private TabView createTabView(ActionBar.Tab tab, boolean forAdapter) {
    //Workaround for not being able to pass a defStyle on pre-3.0
    final TabView tabView = (TabView)mInflater.inflate(R.layout.abs__action_bar_tab, null);
    tabView.init(this, tab, forAdapter);

    if (forAdapter) {
        tabView.setBackgroundDrawable(null);
        tabView.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT,
                mContentHeight));
    } else {
        tabView.setFocusable(true);

        if (mTabClickListener == null) {
            mTabClickListener = new TabClickListener();
        }
        tabView.setOnClickListener(mTabClickListener);
    }
    return tabView;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:20,代码来源:ScrollingTabContainerView.java

示例4: onConfigurationChanged

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    mTitleView = null;
    mSubtitleView = null;
    mTitleUpView = null;
    if (mTitleLayout != null && mTitleLayout.getParent() == this) {
        removeView(mTitleLayout);
    }
    mTitleLayout = null;
    if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
        initTitle();
    }

    if (mTabScrollView != null && mIncludeTabs) {
        ViewGroup.LayoutParams lp = mTabScrollView.getLayoutParams();
        if (lp != null) {
            lp.width = LayoutParams.WRAP_CONTENT;
            lp.height = LayoutParams.MATCH_PARENT;
        }
        mTabScrollView.setAllowCollapse(true);
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:25,代码来源:ActionBarView.java

示例5: onFinishInflate

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    addView(mHomeLayout);

    if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
        final ViewParent parent = mCustomNavView.getParent();
        if (parent != this) {
            if (parent instanceof ViewGroup) {
                ((ViewGroup) parent).removeView(mCustomNavView);
            }
            addView(mCustomNavView);
        }
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:17,代码来源:ActionBarView.java

示例6: configureTab

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
private void configureTab(Tab tab, int position) {
    final TabImpl tabi = (TabImpl) tab;
    final ActionBar.TabListener callback = tabi.getCallback();

    if (callback == null) {
        throw new IllegalStateException("Action Bar Tab must have a Callback");
    }

    tabi.setPosition(position);
    mTabs.add(position, tabi);

    final int count = mTabs.size();
    for (int i = position + 1; i < count; i++) {
        mTabs.get(i).setPosition(i);
    }
}
 
开发者ID:ivanovpv,项目名称:darksms,代码行数:17,代码来源:ActionBarImpl.java

示例7: onTabReselected

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
@Override
public void onTabReselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
    if (mListener != null) {
        FragmentTransaction trans = null;
        if (mActivity instanceof FragmentActivity) {
            trans = ((FragmentActivity) mActivity).getSupportFragmentManager().beginTransaction()
                    .disallowAddToBackStack();
        }

        mListener.onTabReselected(this, trans);

        if (trans != null && !trans.isEmpty()) {
            trans.commit();
        }
    }
}
 
开发者ID:ivanovpv,项目名称:darksms,代码行数:17,代码来源:ActionBarWrapper.java

示例8: onTabSelected

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
@Override
public void onTabSelected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
    if (mListener != null) {

        if (mFragmentTransaction == null && mActivity instanceof FragmentActivity) {
            mFragmentTransaction = ((FragmentActivity) mActivity).getSupportFragmentManager().beginTransaction()
                    .disallowAddToBackStack();
        }

        mListener.onTabSelected(this, mFragmentTransaction);

        if (mFragmentTransaction != null) {
            if (!mFragmentTransaction.isEmpty()) {
                mFragmentTransaction.commit();
            }
            mFragmentTransaction = null;
        }
    }
}
 
开发者ID:ivanovpv,项目名称:darksms,代码行数:20,代码来源:ActionBarWrapper.java

示例9: createTabView

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
private TabView createTabView(ActionBar.Tab tab, boolean forAdapter) {
    //Workaround for not being able to pass a defStyle on pre-3.0
    final TabView tabView = (TabView) mInflater.inflate(R.layout.abs__action_bar_tab, null);
    tabView.init(this, tab, forAdapter);

    if (forAdapter) {
        tabView.setBackgroundDrawable(null);
        tabView.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT,
                mContentHeight));
    } else {
        tabView.setFocusable(true);

        if (mTabClickListener == null) {
            mTabClickListener = new TabClickListener();
        }
        tabView.setOnClickListener(mTabClickListener);
    }
    return tabView;
}
 
开发者ID:ivanovpv,项目名称:darksms,代码行数:20,代码来源:ScrollingTabContainerView.java

示例10: onConfigurationChanged

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    mTitleView = null;
    mSubtitleView = null;
    mTitleUpView = null;
    if (mTitleLayout != null && mTitleLayout.getParent() == this) {
        removeView(mTitleLayout);
    }
    mTitleLayout = null;
    if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
        initTitle();
    }

    if (mTabScrollView != null && mIncludeTabs) {
        LayoutParams lp = mTabScrollView.getLayoutParams();
        if (lp != null) {
            lp.width = LayoutParams.WRAP_CONTENT;
            lp.height = LayoutParams.MATCH_PARENT;
        }
        mTabScrollView.setAllowCollapse(true);
    }
}
 
开发者ID:Aptoide,项目名称:aptoide-backup-apps,代码行数:25,代码来源:ActionBarView.java

示例11: onCreate

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mViewPager = (ViewPager) findViewById(R.id.view_pager);
    final com.actionbarsherlock.app.ActionBar bar = getSupportActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    BarFragment barFrag = new BarFragment();
    LineFragment lineFragment = new LineFragment();
    PieFragment pieFragment = new PieFragment();

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(bar.newTab().setText("Line"),
            LineFragment.class, null, lineFragment);
    mTabsAdapter.addTab(bar.newTab().setText("Pie"),
            PieFragment.class, null, pieFragment);
    mTabsAdapter.addTab(bar.newTab().setText("Bar"),
            BarFragment.class, null, barFrag);


    mViewPager.setOffscreenPageLimit(mTabsAdapter.getCount()-1);
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:25,代码来源:MainActivity.java

示例12: onCreate

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

       setContentView(R.layout.codecs_pager);

       final ActionBar ab = getSupportActionBar();
       ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
       
       ab.setDisplayShowHomeEnabled(true);
       ab.setDisplayShowTitleEnabled(true);
       
       mViewPager = (ViewPager) findViewById(R.id.pager);
       TabsAdapter tabAdapter = new TabsAdapter(this, ab, mViewPager);
       useCodecsPerSpeed = SipConfigManager.getPreferenceBooleanValue(this, SipConfigManager.CODECS_PER_BANDWIDTH);
       showVideoCodecs   = SipConfigManager.getPreferenceBooleanValue(this, SipConfigManager.USE_VIDEO);
       if(useCodecsPerSpeed) {
           Tab audioNb = ab.newTab().setText( R.string.slow ).setIcon(R.drawable.ic_prefs_media);
           Tab audioWb = ab.newTab().setText( R.string.fast ).setIcon(R.drawable.ic_prefs_media);
           tabAdapter.addTab(audioWb, CodecsFragment.class);
           tabAdapter.addTab(audioNb, CodecsFragment.class);
           if(showVideoCodecs) {
               Tab videoNb = ab.newTab().setText( R.string.slow ).setIcon(R.drawable.ic_prefs_media_video);
               Tab videoWb = ab.newTab().setText( R.string.fast ).setIcon(R.drawable.ic_prefs_media_video);
               
               tabAdapter.addTab(videoWb, CodecsFragment.class);
               tabAdapter.addTab(videoNb, CodecsFragment.class);
           }
       }else {
           Tab audioTab = ab.newTab().setIcon(R.drawable.ic_prefs_media);
           tabAdapter.addTab(audioTab, CodecsFragment.class);
           
           if(showVideoCodecs) {
               Tab videoTab = ab.newTab().setIcon(R.drawable.ic_prefs_media_video);
               tabAdapter.addTab(videoTab, CodecsFragment.class);
           }
       }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:39,代码来源:Codecs.java

示例13: TabsAdapter

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
public TabsAdapter(FragmentActivity activity, ActionBar actionBar, ViewPager pager) {
    super(activity.getSupportFragmentManager());
    mContext = activity;
    mActionBar = actionBar;
    mViewPager = pager;
    mViewPager.setAdapter(this);
    mViewPager.setOnPageChangeListener(this);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:9,代码来源:Codecs.java

示例14: onCreate

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle(PrefsLogic.getTitleResourceForType(getPreferenceType()));
    ActionBar ab = getSupportActionBar();
    if(ab != null) {
        ab.setDisplayHomeAsUpEnabled(true);
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:10,代码来源:PrefsLoaderActivity.java

示例15: onCreate

import com.actionbarsherlock.app.ActionBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String accountName = null;
    String wizard = null;
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        accountId = extras.getLong(SipProfile.FIELD_ID, -1);
        accountName = extras.getString(SipProfile.FIELD_DISPLAY_NAME);
        wizard = extras.getString(SipProfile.FIELD_WIZARD);
    }

    if (accountId == -1) {
        Log.e(THIS_FILE, "You provide an empty account id....");
        finish();
    }
    if(!TextUtils.isEmpty(accountName)) {
        setTitle(getResources().getString(R.string.filters) + " : " + accountName);
    }
    if(!TextUtils.isEmpty(wizard)) {
        ActionBar ab = getSupportActionBar();
        if(ab != null) {
            ab.setIcon(WizardUtils.getWizardIconRes(wizard));
        }
    }

    setContentView(R.layout.account_filters_view);
    listFragment = (AccountFiltersListFragment) getSupportFragmentManager().findFragmentById(R.id.list);
    listFragment.setAccountId(accountId);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:32,代码来源:AccountFilters.java


注:本文中的com.actionbarsherlock.app.ActionBar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。