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


Java ActionBar类代码示例

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


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

示例1: onCreate

import android.app.ActionBar; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    decorView.setSystemUiVisibility(uiOptions);
    ActionBar actionBar = getActionBar();
    if (null != actionBar) actionBar.hide();
    ButterKnife.bind(this);
    FirebaseAuth auth = FirebaseAuth.getInstance();
    if (auth.getCurrentUser() != null) {
        showWhiteSnackBar(R.string.sign_in_successful);
        googleLoginButton.setVisibility(View.INVISIBLE);
        Intent intent = new Intent(getApplicationContext(), MainActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
        finish();
    }

}
 
开发者ID:vixir,项目名称:Perfect-Day,代码行数:22,代码来源:LoginActivity.java

示例2: onCreate

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

    if(savedInstanceState != null) {
        if (savedInstanceState.getInt("theme", -1) != -1) {
          mThemeId = savedInstanceState.getInt("theme");
          this.setTheme(mThemeId);
        }
        mTitlesHidden = savedInstanceState.getBoolean("titlesHidden");
    }

    setContentView(R.layout.main);

    ActionBar bar = getActionBar();
    bar.setDisplayShowTitleEnabled(false);

    ContentFragment frag = (ContentFragment) getFragmentManager()
            .findFragmentById(R.id.content_frag);
    if (frag != null) mDualFragments = true;
    
    if (mTitlesHidden) {
        getFragmentManager().beginTransaction()
                .hide(getFragmentManager().findFragmentById(R.id.titles_frag)).commit();
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:27,代码来源:MainActivity.java

示例3: setActionBarDescription

import android.app.ActionBar; //导入依赖的package包/类
public static SetIndicatorInfo setActionBarDescription(SetIndicatorInfo info, Activity activity, int contentDescRes) {
    if (info == null) {
        info = new SetIndicatorInfo(activity);
    }
    if (info.setHomeAsUpIndicator != null) {
        try {
            ActionBar actionBar = activity.getActionBar();
            info.setHomeActionContentDescription.invoke(actionBar, new Object[]{Integer.valueOf(contentDescRes)});
            if (VERSION.SDK_INT <= 19) {
                actionBar.setSubtitle(actionBar.getSubtitle());
            }
        } catch (Exception e) {
            Log.w(TAG, "Couldn't set content description via JB-MR2 API", e);
        }
    }
    return info;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:ActionBarDrawerToggleHoneycomb.java

示例4: onCreate

import android.app.ActionBar; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    this.setTheme(R.style.SettingsTheme);

    super.onCreate(savedInstanceState);

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setIcon(R.drawable.null_icon);
    if (InterfaceUtils.getTabletMode(this)) {
        addPreferencesFromResource(R.xml.preferences_tab);
    } else {
        addPreferencesFromResource(R.xml.preferences);
    }
}
 
开发者ID:89luca89,项目名称:ThunderMusic,代码行数:17,代码来源:PreferencesActivity.java

示例5: setActionBarUpIndicator

import android.app.ActionBar; //导入依赖的package包/类
public static SetIndicatorInfo setActionBarUpIndicator(SetIndicatorInfo info, Activity activity, Drawable drawable, int contentDescRes) {
    info = new SetIndicatorInfo(activity);
    if (info.setHomeAsUpIndicator != null) {
        try {
            ActionBar actionBar = activity.getActionBar();
            info.setHomeAsUpIndicator.invoke(actionBar, new Object[]{drawable});
            info.setHomeActionContentDescription.invoke(actionBar, new Object[]{Integer.valueOf(contentDescRes)});
        } catch (Exception e) {
            Log.w(TAG, "Couldn't set home-as-up indicator via JB-MR2 API", e);
        }
    } else if (info.upIndicatorView != null) {
        info.upIndicatorView.setImageDrawable(drawable);
    } else {
        Log.w(TAG, "Couldn't set home-as-up indicator");
    }
    return info;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:ActionBarDrawerToggleHoneycomb.java

示例6: onCreate

import android.app.ActionBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	// FIXME: Observed exception "IllegalAccessException (@MainActivity:onCreate:16) {main}"

       // Init some singletons which need the Context
       Analytics.getInstance().init(this);
       SettingsUtils.getInstance().init(this);

	setContentView(R.layout.activity_main);

	final ActionBar actionBar=getActionBar();
	if (actionBar!=null) {
           actionBar.setDisplayShowTitleEnabled(true);
           //actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
       }

       final IntentFilter filter=new IntentFilter();
       filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED);
       filter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED);
       registerReceiver(usbReceiver,filter);
}
 
开发者ID:videgro,项目名称:Ships,代码行数:23,代码来源:MainActivity.java

示例7: setActionBarUpIndicator

import android.app.ActionBar; //导入依赖的package包/类
public static void setActionBarUpIndicator(Object info, Activity activity, Drawable drawable, int contentDescRes) {

        final SetIndicatorInfo sii = (SetIndicatorInfo) info;
        if (sii.setHomeAsUpIndicator != null) {
            try {
                final ActionBar actionBar = activity.getActionBar();
                sii.setHomeAsUpIndicator.invoke(actionBar, drawable);
                sii.setHomeActionContentDescription.invoke(actionBar, contentDescRes);
            } catch (Throwable t) {
                if (ActionBarHelper.DEBUG) Log.e(TAG, "Couldn't set home-as-up indicator via JB-MR2 API", t);
            }
        } else if (sii.upIndicatorView != null) {
            sii.upIndicatorView.setImageDrawable(drawable);
        } else {
            if (ActionBarHelper.DEBUG) Log.e(TAG, "Couldn't set home-as-up indicator");
        }
    }
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:18,代码来源:ActionBarHelperNative.java

示例8: setActionBarDescription

import android.app.ActionBar; //导入依赖的package包/类
public static Object setActionBarDescription(Object info, Activity activity, int contentDescRes) {
    SetIndicatorInfo setIndicatorInfo;
    if (info == null) {
        setIndicatorInfo = new SetIndicatorInfo(activity);
    }
    SetIndicatorInfo sii = setIndicatorInfo;
    if (sii.setHomeAsUpIndicator != null) {
        try {
            ActionBar actionBar = activity.getActionBar();
            sii.setHomeActionContentDescription.invoke(actionBar, new Object[]{Integer.valueOf(contentDescRes)});
            if (VERSION.SDK_INT <= 19) {
                actionBar.setSubtitle(actionBar.getSubtitle());
            }
        } catch (Exception e) {
            Log.w(TAG, "Couldn't set content description via JB-MR2 API", e);
        }
    }
    return setIndicatorInfo;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:ActionBarDrawerToggleHoneycomb.java

示例9: onCreate

import android.app.ActionBar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    decorView.setSystemUiVisibility(uiOptions);
    ActionBar actionBar = getActionBar();
    if (null != actionBar) actionBar.hide();
    mBottomBar.setOnTabSelectListener(
            new OnTabSelectListener() {
                @Override
                public void onTabSelected(@IdRes int tabId) {
                    Fragment fragment;
                    switch (tabId) {
                        case R.id.bot_bar_today:
                            fragment = new TodayTasksFragment();
                            break;
                        case R.id.bot_bar_list:
                            fragment = new ListTasksFragment();
                            break;
                        case R.id.bot_bar_more:
                            fragment = new MoreInfoFragment();
                            break;
                        default:
                            fragment = new TodayTasksFragment();
                    }
                    FragmentManager fragmentManager = getSupportFragmentManager();
                    FragmentTransaction ft = fragmentManager.beginTransaction();
                    ft.replace(R.id.flContent, fragment, fragment.getClass().getName());
                    ft.commit();
                }
            });
}
 
开发者ID:vixir,项目名称:Perfect-Day,代码行数:36,代码来源:MainActivity.java

示例10: setActionBarDescription

import android.app.ActionBar; //导入依赖的package包/类
public static SetIndicatorInfo setActionBarDescription(SetIndicatorInfo info, Activity activity,
                                                       int contentDescRes) {
    if (info == null) {
        info = new SetIndicatorInfo(activity);
    }
    if (info.setHomeAsUpIndicator != null) {
        try {
            final ActionBar actionBar = activity.getActionBar();
            info.setHomeActionContentDescription.invoke(actionBar, contentDescRes);
            if (Build.VERSION.SDK_INT <= 19) {
                // For API 19 and earlier, we need to manually force the
                // action bar to generate a new content description.
                actionBar.setSubtitle(actionBar.getSubtitle());
            }
        } catch (Exception e) {
            Log.w(TAG, "Couldn't set content description via JB-MR2 API", e);
        }
    }
    return info;
}
 
开发者ID:PSD-Company,项目名称:duo-navigation-drawer,代码行数:21,代码来源:DuoDrawerToggleHoneycomb.java

示例11: onPreferenceTreeClick

import android.app.ActionBar; //导入依赖的package包/类
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
                                     Preference preference)
{
    boolean result =
        super.onPreferenceTreeClick(preferenceScreen, preference);

    // Set home as up
    if (preference instanceof PreferenceScreen)
    {
        Dialog dialog = ((PreferenceScreen)preference).getDialog();
        ActionBar actionBar = dialog.getActionBar();
        actionBar.setDisplayHomeAsUpEnabled(false);
    }

    return result;
}
 
开发者ID:billthefarmer,项目名称:diary,代码行数:18,代码来源:SettingsFragment.java

示例12: setActionBarUpIndicator

import android.app.ActionBar; //导入依赖的package包/类
public static Object setActionBarUpIndicator(Object info, Activity activity, Drawable drawable, int contentDescRes) {
    SetIndicatorInfo setIndicatorInfo;
    if (info == null) {
        setIndicatorInfo = new SetIndicatorInfo(activity);
    }
    SetIndicatorInfo sii = setIndicatorInfo;
    if (sii.setHomeAsUpIndicator != null) {
        try {
            ActionBar actionBar = activity.getActionBar();
            sii.setHomeAsUpIndicator.invoke(actionBar, new Object[]{drawable});
            sii.setHomeActionContentDescription.invoke(actionBar, new Object[]{Integer.valueOf(contentDescRes)});
        } catch (Exception e) {
            Log.w(TAG, "Couldn't set home-as-up indicator via JB-MR2 API", e);
        }
    } else if (sii.upIndicatorView != null) {
        sii.upIndicatorView.setImageDrawable(drawable);
    } else {
        Log.w(TAG, "Couldn't set home-as-up indicator");
    }
    return setIndicatorInfo;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:22,代码来源:ActionBarDrawerToggleHoneycomb.java

示例13: menuBarsHide

import android.app.ActionBar; //导入依赖的package包/类
private void menuBarsHide() {
    Log.d(getClass().getName(), "menuBarsHide");
    ActionBar actionBar = getActionBar();
    if (actionBar == null) {
        Log.d(getClass().getName(), "menuBarsHide ActionBar is null");
        return;
    }

    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().clearFlags(
            WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    getWindow().getDecorView().setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LOW_PROFILE);
    actionBar.hide(); // slides out
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:18,代码来源:ImageViewerActivity.java

示例14: makeDoneCancelLayout

import android.app.ActionBar; //导入依赖的package包/类
public static View makeDoneCancelLayout(int layoutId,
                                        LayoutInflater layoutInflater,
                                        int doneId,
                                        View.OnClickListener onDoneListener,
                                        int cancelId,
                                        View.OnClickListener onCancelListener) {
    @SuppressLint("InflateParams")
    LinearLayout doneDiscardLayout = (LinearLayout) layoutInflater.inflate(layoutId,
            null);
    doneDiscardLayout.setLayoutParams(new ActionBar.LayoutParams(
            ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT));
    doneDiscardLayout.findViewById(doneId)
            .setOnClickListener(onDoneListener);
    doneDiscardLayout.findViewById(cancelId)
            .setOnClickListener(onCancelListener);
    return doneDiscardLayout;
}
 
开发者ID:HanyeeWang,项目名称:GeekZone,代码行数:18,代码来源:AppUtils.java

示例15: setTitle

import android.app.ActionBar; //导入依赖的package包/类
public static void setTitle(android.support.v7.app.ActionBar actionBar, SpannableString spannableString) {
	// BUGFIX
	// @see http://stackoverflow.com/questions/7658725/android-java-lang-illegalargumentexception-invalid-payload-item-type
	if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN && Build.MANUFACTURER.toUpperCase().equals("LGE")) {
		actionBar.setTitle(spannableString.toString());
	} else {
		actionBar.setTitle(spannableString);
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:ActionBarHelper.java


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