本文整理匯總了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();
}
}
}
示例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;
}
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
示例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();
}
}
}
示例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;
}
}
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
示例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);
}