本文整理汇总了Java中android.support.v7.app.ActionBarActivity.getSupportActionBar方法的典型用法代码示例。如果您正苦于以下问题:Java ActionBarActivity.getSupportActionBar方法的具体用法?Java ActionBarActivity.getSupportActionBar怎么用?Java ActionBarActivity.getSupportActionBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.app.ActionBarActivity
的用法示例。
在下文中一共展示了ActionBarActivity.getSupportActionBar方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpOrCancelMotionEvent
import android.support.v7.app.ActionBarActivity; //导入方法依赖的package包/类
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
ActionBarActivity activity = (ActionBarActivity) getActivity();
if (activity == null) {
return;
}
ActionBar ab = activity.getSupportActionBar();
if (scrollState == ScrollState.UP) {
if (ab.isShowing()) {
ab.hide();
}
} else if (scrollState == ScrollState.DOWN) {
if (!ab.isShowing()) {
ab.show();
}
}
}
开发者ID:brucetoo,项目名称:Android-ObservableScrollView,代码行数:18,代码来源:FragmentActionBarControlListViewFragment.java
示例2: changeToBack
import android.support.v7.app.ActionBarActivity; //导入方法依赖的package包/类
private ToolbarWrapper changeToBack(final ViewGroup contentView) {
final ActionBarActivity aty = (ActionBarActivity) contentView.getContext();
ToolbarWrapper contain = (ToolbarWrapper) View.inflate(mContext, R.layout.view_toolbar, null);
Toolbar newTb = ButterKnife.findById(contain, R.id.toolbar);
newTb.setTag("backToolbar");
aty.setSupportActionBar(newTb);/*替换toolBar为actionBar*/
final ActionBar supportActionBar = aty.getSupportActionBar();
supportActionBar.setHomeButtonEnabled(true); // 设置返回键可用
supportActionBar.setDisplayHomeAsUpEnabled(true);
/*supportActionBar.setHomeAsUpIndicator(R.drawable.ic_launcher);*//*设置返回键样式*/
newTb.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
aty.finish();
}
});
return contain;
}
示例3: showGlobalContextActionBar
import android.support.v7.app.ActionBarActivity; //导入方法依赖的package包/类
/**
* Per the navigation drawer design guidelines, updates the action bar to show the global app
* 'context', rather than just what's in the current screen.
*/
private void showGlobalContextActionBar() {
ActionBarActivity actionBarActivity = (ActionBarActivity) getActivity();
actionBarActivity.getSupportActionBar();
actionBarActivity.getSupportActionBar().setTitle(R.string.app_name);
((ActionBarActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
((ActionBarActivity) getActivity()).getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}
示例4: setActionbarTitle
import android.support.v7.app.ActionBarActivity; //导入方法依赖的package包/类
public static void setActionbarTitle(ActionBarActivity activity, Spanned title,
String subtitle) {
android.support.v7.app.ActionBar actionBar = activity.getSupportActionBar();
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
if(PreferencesState.getInstance().isDevelopOptionActive()) {
actionBar.setCustomView(R.layout.dev_custom_action_bar);
String server = PreferencesState.getInstance().getServerUrl();
((CustomTextView) actionBar.getCustomView().findViewById(R.id.action_bar_multititle_dev_subtitle)).setText(server);
}else {
actionBar.setCustomView(R.layout.custom_action_bar);
}
((CustomTextView) activity.findViewById(R.id.action_bar_multititle_title)).setText(title);
((CustomTextView) activity.findViewById(R.id.action_bar_multititle_subtitle)).setText(subtitle);
}
示例5: setActionbarAppName
import android.support.v7.app.ActionBarActivity; //导入方法依赖的package包/类
public static void setActionbarAppName(ActionBarActivity activity) {
android.support.v7.app.ActionBar actionBar = activity.getSupportActionBar();
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setCustomView(R.layout.abc_action_bar_title_item);
actionBar.setSubtitle(null);
actionBar.setTitle(activity.getResources().getString(R.string.app_name));
}
示例6: showGlobalContextActionBar
import android.support.v7.app.ActionBarActivity; //导入方法依赖的package包/类
/**
* Per the navigation drawer design guidelines, updates the action bar to show the global app
* 'context', rather than just what's in the current screen.
*/
private void showGlobalContextActionBar() {
//ActionBar actionBar = getActionBar();
//actionBar.setDisplayShowTitleEnabled(true);
//actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
//actionBar.setTitle(R.string.app_name);
Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar);
ActionBarActivity actionBarActivity = (ActionBarActivity) getActivity();
actionBarActivity.getSupportActionBar();
actionBarActivity.getSupportActionBar().setTitle(R.string.app_name);
//toolbar.setTitle(R.string.app_name);
((ActionBarActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
((ActionBarActivity) getActivity()).getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}
示例7: onStart
import android.support.v7.app.ActionBarActivity; //导入方法依赖的package包/类
@Override public void onStart() {
super.onStart();
ActionBarActivity activity = (ActionBarActivity) getActivity();
if (activity != null) {
ActionBar actionBar = activity.getSupportActionBar();
final Integer titleResId = getActionBarTitle();
if (actionBar != null && titleResId != null) {
actionBar.setTitle(titleResId);
}
}
}
示例8: setActionBarBackButton
import android.support.v7.app.ActionBarActivity; //导入方法依赖的package包/类
public static void setActionBarBackButton(ActionBarActivity activity) {
android.support.v7.app.ActionBar actionBar = activity.getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}