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


Java ActionBar.setDisplayHomeAsUpEnabled方法代码示例

本文整理汇总了Java中android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java ActionBar.setDisplayHomeAsUpEnabled方法的具体用法?Java ActionBar.setDisplayHomeAsUpEnabled怎么用?Java ActionBar.setDisplayHomeAsUpEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v7.app.ActionBar的用法示例。


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

示例1: setTitleBar

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void setTitleBar() {
        setSupportActionBar(binding.titleToolBar);
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            //去除默认Title显示
            actionBar.setDisplayShowTitleEnabled(false);
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setHomeAsUpIndicator(R.drawable.icon_back);
//            actionBar.setTitle(subjectsBean.getTitle());
//            actionBar.setSubtitle("主演:" + StringFormatUtil.formatName(subjectsBean.getCasts()));
        }

        // title
        binding.tvTitle.setText(subjectsBean.getTitle());
        // 副标题
        binding.tvSubtitle.setText("主演:" + StringFormatUtil.formatName(subjectsBean.getCasts()));

        binding.titleToolBar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
    }
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:25,代码来源:SlideScrollViewActivity.java

示例2: initData

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected void initData() {
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        paraMap.put("companyId", bundle.getString("CompanyId"));
        if (mToolbar != null) {
            setSupportActionBar(mToolbar);
            ActionBar mActionBar = getSupportActionBar();
            if (mActionBar != null) {
                mActionBar.setDisplayHomeAsUpEnabled(true);
                mActionBar.setTitle("商机报备 -> " + bundle.getString("CompanyShortName"));
            }
        }
    }
    new OpportunityPresenter(this);
    presenter.getData(1, SIZE, paraMap);
}
 
开发者ID:liuyongfeng90,项目名称:JKCloud,代码行数:18,代码来源:OpportunityListActivity.java

示例3: onCreate

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

    setContentView(R.layout.activity_request_edit);

    ButterKnife.bind(this);

    setSupportActionBar(toolbar);
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.drawable.ic_close_white_24dp);
        actionBar.setTitle(R.string.title_edit_request);
    }
}
 
开发者ID:jboss-outreach,项目名称:rest-android,代码行数:17,代码来源:EditRequestActivity.java

示例4: setAllView

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void setAllView() {
    setContentView(R.layout.activity_edit);
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
    editListAdapter = new EditListAdapter(this, EditWordMethod.viewExtraWordList(ExtraWordsPath));
    RecyclerView recyclerView = findViewById(R.id.list_edit);
    recyclerView.setAdapter(editListAdapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
}
 
开发者ID:XFY9326,项目名称:CatchSpy,代码行数:14,代码来源:EditActivity.java

示例5: onCreate

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_fragment_view_pager);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle("LIST FRAGMENT VIEWPAGER");
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
    initView();
}
 
开发者ID:dueeeke,项目名称:dkplayer,代码行数:13,代码来源:ListFragmentViewPagerActivity.java

示例6: setupActionBar

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void  setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        // Show the Up button in the action bar.
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
开发者ID:andresth,项目名称:Kandroid,代码行数:8,代码来源:SettingsActivity.java

示例7: onCreate

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    ActionBar actionBar = this.getSupportActionBar();

    // Set the action bar back button to look like an up button
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
开发者ID:fjoglar,项目名称:android-dev-challenge,代码行数:12,代码来源:SettingsActivity.java

示例8: onCreate

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_player);
        ButterKnife.bind(this);

        setSupportActionBar(toolbar);

        toolbar.setNavigationOnClickListener(this);
        ActionBar actionBar = getSupportActionBar();
        if (null != actionBar) {
            actionBar.setDisplayHomeAsUpEnabled(true);
        }

        mAdapter = new DiscPagerAdapter(getLayoutInflater());
        mViewPager.setAdapter(mAdapter);

        mDiscChanger = new DiscPageChanger(mViewPager, needle);
        mViewPager.addOnPageChangeListener(mDiscChanger);


        mPresenter = new PlayerPresenter(this);
        mConfigPresenter = new ConfigPresenter(this);

//        mPresenter.setPlaylist(id, position);

//        ivPlay.setImageResource(PlayerManager.newInstance(this).isPause() ? R.drawable.ic_play : R.drawable.ic_pause);


//        setBlurBackground(BitmapFactory.decodeResource(getResources(), R.drawable.play_bg_night));
        orders = getResources().getStringArray(R.array.array_music_order);
        mPresenter.requestMusicInfo();
        mConfigPresenter.requestLoadingList();
    }
 
开发者ID:piyell,项目名称:NeteaseCloudMusic,代码行数:36,代码来源:PlayerActivity.java

示例9: initToolBar

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
public void initToolBar() {

  mToolbar.setTitle("");
  setSupportActionBar(mToolbar);
  ActionBar supportActionBar = getSupportActionBar();
  if (supportActionBar != null) {
    supportActionBar.setDisplayHomeAsUpEnabled(true);
  }

  //设置StatusBar透明
  SystemBarHelper.immersiveStatusBar(this);
  SystemBarHelper.setHeightAndPadding(this, mToolbar);

  //设置AppBar展开折叠状态监听
  mAppBarLayout.addOnOffsetChangedListener(new AppBarStateChangeEvent() {

    @Override
    public void onStateChanged(AppBarLayout appBarLayout, State state, int verticalOffset) {

      if (state == State.EXPANDED) {
        //展开状态
        mCollapsingToolbarLayout.setTitle("");
        mLineView.setVisibility(View.VISIBLE);
      } else if (state == State.COLLAPSED) {
        //折叠状态
        mCollapsingToolbarLayout.setTitle(name);
        mLineView.setVisibility(View.GONE);
      } else {
        mCollapsingToolbarLayout.setTitle("");
        mLineView.setVisibility(View.VISIBLE);
      }
    }
  });
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:36,代码来源:UserInfoDetailsActivity.java

示例10: onCreate

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_downloading);
    Toolbar toolbar = findViewById(R.id.toolBar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(R.string.downloading);
    }

    showFragment(new DownloadFragment(), null);
}
 
开发者ID:mingdroid,项目名称:tumbviewer,代码行数:15,代码来源:DownloadingActivity.java

示例11: onCreateView

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(
            R.layout.fragment_playlist, container, false);

    Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
    pager = (MultiViewPager) rootView.findViewById(R.id.playlistpager);
    recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);


    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);

    final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.ic_menu);
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setTitle(R.string.playlists);

    playlists = PlaylistLoader.getPlaylists(getActivity(), showAuto);
    playlistcount = playlists.size();

    if (isDefault) {
        initPager();
    } else {
        initRecyclerView();
    }

    return rootView;

}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:30,代码来源:PlaylistFragment.java

示例12: onCreateView

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.dialog_book_info_read_more, container, false);

    Bundle args = getArguments();
    String title = args.getString(KEY_DIALOG_FRAGMENT_TITLE, getResources().getString(R.string.authors));
    Toolbar toolbar = rootView.findViewById(R.id.toolbar);
    toolbar.setTitle(title);

    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);

    ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);

        Drawable drawable = getResources()
                .getDrawable(R.drawable.ic_close_white_24dp);
        drawable = DrawableCompat.wrap(drawable);
        DrawableCompat.setTint(drawable, Color.WHITE);
        actionBar.setHomeAsUpIndicator(drawable);
    }


    String body = args.getString(KEY_DIALOG_BODY, getResources().getString(R.string.authors));
    TextView bodyTextView = rootView.findViewById(R.id.more_dialog_body_text_view);
    bodyTextView.setText(body);
    setHasOptionsMenu(true);
    return rootView;
}
 
开发者ID:fekracomputers,项目名称:IslamicLibraryAndroid,代码行数:32,代码来源:BookInformationMoreDialogFragment.java

示例13: onCreate

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

    setContentView(R.layout.activity_response_details);

    ButterKnife.bind(this);

    setSupportActionBar(toolbar);
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(R.string.title_response_details);
    }
}
 
开发者ID:jboss-outreach,项目名称:rest-android,代码行数:16,代码来源:ResponseDetailsActivity.java

示例14: initToolBar

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
public void initToolBar() {
    mToolbar.setTitle("番剧详情");
    setSupportActionBar(mToolbar);
    ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null) {
        supportActionBar.setDisplayHomeAsUpEnabled(true);
    }

    // 设置 Toolbar 的透明度
    mToolbar.setBackgroundColor(Color.argb(0, 251, 114, 163));

    // 设置 StatusBar 的透明度
    SystemBarHelper.immersiveStatusBar(this);
    SystemBarHelper.setPadding(this, mToolbar);

    //获取顶部image高度和toolbar高度
    float imageHeight = getResources().getDimension(R.dimen.bangumi_details_top_layout_height);
    float toolBarHeight = getResources().getDimension(R.dimen.action_bar_default_height);

    mNestedScrollView.setNestedScrollingEnabled(true);
    mNestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
        @Override
        public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
            // 根据 NestedScrollView 滑动改变 Toolbar 的透明度
            float offsetY = toolBarHeight - imageHeight;
            //计算滑动距离的偏移量
            float offset = 1 - Math.max((offsetY - scrollY) / offsetY, 0f);
            float absOffset = Math.abs(offset);
            //如果滑动距离大于1就设置完全不透明度
            if (absOffset >= 1) {
                absOffset = 1;
            }
            mToolbar.setBackgroundColor(Color.argb((int) (absOffset * 255), 251, 114, 153));
        }
    });
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:38,代码来源:BangumiDetailsActivity.java

示例15: setupActionBar

import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
/**
 * Set up the {@link android.app.ActionBar}, if the API is available.
 */
private void setupActionBar() {
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        // Show the Up button in the action bar.
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
开发者ID:GrenderG,项目名称:Protestr,代码行数:11,代码来源:SettingsActivity.java


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