當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。