當前位置: 首頁>>代碼示例>>Java>>正文


Java ActionBar.setDisplayShowHomeEnabled方法代碼示例

本文整理匯總了Java中android.support.v7.app.ActionBar.setDisplayShowHomeEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionBar.setDisplayShowHomeEnabled方法的具體用法?Java ActionBar.setDisplayShowHomeEnabled怎麽用?Java ActionBar.setDisplayShowHomeEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.app.ActionBar的用法示例。


在下文中一共展示了ActionBar.setDisplayShowHomeEnabled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
private void init() {
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    if (toolbar != null) {
        setSupportActionBar(toolbar);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onBackPressed();
            }
        });
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setDisplayHomeAsUpEnabled(true);
            /* NOTE: Hide the origin title view */
            actionBar.setDisplayShowTitleEnabled(false);
        }
    } else {
        Log.e(TAG, "Toolbar == null");
    }
}
 
開發者ID:drakeet,項目名稱:rebase-android,代碼行數:22,代碼來源:ToolbarActivity.java

示例2: setContentView

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void setContentView(@LayoutRes int layoutResID) {
    super.setContentView(layoutResID);
    ButterKnife.bind(holder, this);
    toolbar = holder.toolbar;

    if (toolbar != null) {
        setSupportActionBar(toolbar);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onBackPressed();
            }
        });
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayShowHomeEnabled(true);
            if (canBack()) {
                getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            }
        }
    }
}
 
開發者ID:drakeet,項目名稱:rebase-android,代碼行數:24,代碼來源:ToolbarActivity.java

示例3: onInitToolbar

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
public void onInitToolbar(Toolbar toolBar, String title, int icon, boolean displayHome) {

        if (toolBar != null) {
            setSupportActionBar(toolBar);
            ActionBar actionBar = getSupportActionBar();

            if (actionBar != null) {
                actionBar.setTitle(title);
                actionBar.setDisplayShowHomeEnabled(displayHome);
                actionBar.setDisplayHomeAsUpEnabled(displayHome);
                if (icon != -1 && displayHome) {
                    toolBar.setNavigationIcon(ContextCompat.getDrawable(this, icon));
                }
            }
        }
    }
 
開發者ID:rudsonlive,項目名稱:liveomvp,代碼行數:17,代碼來源:BaseActivity.java

示例4: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
/**
 * Sets up the swipe gallery
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.user_gallery);

    // Creates a back button on the action bar
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    // Instantiate a ViewPager and a PagerAdapter.
    mPager = (ViewPager) findViewById(R.id.gallery);
    mPagerAdapter = new UserGalleryAdapter(getSupportFragmentManager());
    mPager.setAdapter(mPagerAdapter);
}
 
開發者ID:chrisqz95,項目名稱:couch-potatoes,代碼行數:19,代碼來源:UserGalleryActivity.java

示例5: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_record_list);
  Toolbar toolbar = findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  ActionBar actionBar = getSupportActionBar();
  if (actionBar != null) {
    actionBar.setTitle(R.string.tab_title_saved_recordings);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);
  }
  setNavBarColor();

  if (savedInstanceState == null) {
    getSupportFragmentManager().beginTransaction()
        .add(R.id.record_list_container, PlayListFragment.newInstance())
        .commit();
  }
}
 
開發者ID:Arjun-sna,項目名稱:Android-AudioRecorder-App,代碼行數:20,代碼來源:PlayListActivity.java

示例6: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onCreate(@Nullable final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setSupportActionBar(toolbar);

    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }

    final Intent intent = getIntent();
    if (intent == null) {
        throw new IllegalStateException("Missing intent");
    }
    final Item item = (Item) intent.getSerializableExtra(EXTRA_ITEM);
    if (item instanceof Weapon) {
        showFragment(WeaponDetailFragment.newInstance((Weapon) item), WeaponDetailFragment.TAG);
    } else if (item instanceof Ammo) {
        showFragment(AmmoDetailFragment.newInstance((Ammo) item), WeaponDetailFragment.TAG);
    } else {
        Toast.makeText(this, "We're still working on this feature!", Toast.LENGTH_SHORT).show();
        finish();
    }
}
 
開發者ID:ZafraniTechLLC,項目名稱:Companion-For-PUBG-Android,代碼行數:27,代碼來源:ItemDetailActivity.java

示例7: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setSupportActionBar(toolbar);

    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }

    final Intent intent = getIntent();
    if (intent == null) {
        throw new IllegalStateException("Missing intent");
    }
    final String newsItemSrc = intent.getStringExtra(EXTRA_NEWSITEM_SRC);
    showFragment(NewsDetailFragment.newInstance(newsItemSrc), NewsDetailFragment.TAG);

}
 
開發者ID:ZafraniTechLLC,項目名稱:Companion-For-PUBG-Android,代碼行數:21,代碼來源:NewsDetailActivity.java

示例8: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar actionBar=getSupportActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_black_24dp);
    actionBar.setDisplayShowHomeEnabled(true);
    setContentView(R.layout.activity_main4);
    go();
}
 
開發者ID:iamjaspreetsingh,項目名稱:LifeSaver,代碼行數:13,代碼來源:Main4Activity.java

示例9: setToolbar

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
protected void setToolbar(final Toolbar toolbar) {
    setSupportActionBar(toolbar);
    @Nullable final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
    } else {
        Timber.w("Cannot get an action bar for this activity; verify that this activity has actually defined a toolbar.");
    }
}
 
開發者ID:ParaskP7,項目名稱:sample-code-posts,代碼行數:12,代碼來源:AbstractAppActivity.java

示例10: setupToolBar

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
private void setupToolBar() {
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }
    updateChannelView();
}
 
開發者ID:graviton57,項目名稱:TVGuide,代碼行數:12,代碼來源:MainActivity.java

示例11: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_saved_toot);

    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar bar = getSupportActionBar();
    if (bar != null) {
        bar.setTitle(getString(R.string.title_saved_toot));
        bar.setDisplayHomeAsUpEnabled(true);
        bar.setDisplayShowHomeEnabled(true);
    }

    RecyclerView recyclerView = findViewById(R.id.recycler_view);
    noContent = findViewById(R.id.no_content);
    recyclerView.setHasFixedSize(true);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    recyclerView.setLayoutManager(layoutManager);
    DividerItemDecoration divider = new DividerItemDecoration(
            this, layoutManager.getOrientation());
    Drawable drawable = ThemeUtils.getDrawable(this, R.attr.status_divider_drawable,
            R.drawable.status_divider_dark);
    divider.setDrawable(drawable);
    recyclerView.addItemDecoration(divider);
    adapter = new SavedTootAdapter(this);
    recyclerView.setAdapter(adapter);
}
 
開發者ID:Vavassor,項目名稱:Tusky,代碼行數:29,代碼來源:SavedTootActivity.java

示例12: onCreate

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_showpic);
    ButterKnife.bind(this);
    setSupportActionBar(toolbar);
    ActionBar ab = getSupportActionBar();
    if (ab != null) {
        ab.setTitle("圖片");
        ab.setDisplayHomeAsUpEnabled(true);
        ab.setDisplayShowHomeEnabled(true);
    }
    bitmap = getIntent().getParcelableExtra("img");
    mPhotoView.setImageBitmap(bitmap);
}
 
開發者ID:shenhuanet,項目名稱:PCController-android,代碼行數:16,代碼來源:ShowPictureActivity.java

示例13: onShow

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onShow(String title) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle(title);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }
}
 
開發者ID:shenhuanet,項目名稱:Ocr-android,代碼行數:10,代碼來源:MainActivity.java

示例14: setUpToolbar

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
private void setUpToolbar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(mCategoryName);
    setSupportActionBar(toolbar);
    ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null) {
        //make Android Studio happy
        supportActionBar.setDisplayHomeAsUpEnabled(true);
        supportActionBar.setDisplayShowHomeEnabled(true);
    }
    toolbar.setNavigationOnClickListener(v -> finish());
}
 
開發者ID:hyb1996,項目名稱:NodeET,代碼行數:13,代碼來源:TopicListActivity.java

示例15: setUpActionBar

import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
private void setUpActionBar() {
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }
}
 
開發者ID:huazhouwang,項目名稱:Synapse,代碼行數:8,代碼來源:ModelDetailActivity.java


注:本文中的android.support.v7.app.ActionBar.setDisplayShowHomeEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。