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