本文整理汇总了Java中android.support.v7.app.ActionBar.setHomeButtonEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java ActionBar.setHomeButtonEnabled方法的具体用法?Java ActionBar.setHomeButtonEnabled怎么用?Java ActionBar.setHomeButtonEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.app.ActionBar
的用法示例。
在下文中一共展示了ActionBar.setHomeButtonEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preview_photo);
initializeMembers();
Bitmap bitmap = PhotoUtils.prepareBitmap(photoUri, photoImage);
photoImage.setImageBitmap(bitmap);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
actionBar.setTitle(R.string.medicine_photo);
actionBar.show();
}
示例2: onCreate
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_container);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
ActionBar ab = initActionBar(getSupportActionBar(), R.string.title_activity_main);
ab.setDisplayHomeAsUpEnabled(false);
ab.setHomeButtonEnabled(false);
boolean isNoBrowser = false;
if (getIntent() != null) {
isNoBrowser = getIntent().getBooleanExtra("no_browser", false);
}
Fragment fragment = MainFragment.newInstance(isNoBrowser);
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.container, fragment)
.commit();
}
示例3: 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());
}
示例4: onCreate
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
mActivity = this;
}
示例5: setAllView
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void setAllView() {
setContentView(R.layout.activity_rule);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
String data = IOMethod.getFromAssets(this, Config.DEFAULT_RULE_FILE_NAME);
if (data != null) {
((TextView) findViewById(R.id.textview_rule)).setText(data);
}
}
示例6: 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;
}
示例7: onCreate
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_restore);
ActionBar actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
// address
mAdView = (AdView) findViewById(R.id.adView1);
mText = (TextView) findViewById(R.id.textView);
mList = (ListView) findViewById(R.id.list1);
mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swiperefresh1);
// ads
MobileAds.initialize(this, "ca-app-pub-9646303341923759~9003031985");
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
show_list();
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
mSwipeRefreshLayout.setRefreshing(true);
refreshItems();
}
});
}
示例8: setupToolBar
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
private void setupToolBar() {
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
}
}
示例9: createMenu
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected void createMenu() {
Toolbar toolbar = (Toolbar) mRootView.findViewById(R.id.toolbar);
toolbar.setTitle(R.string.add_title);
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
actionBar.setHomeAsUpIndicator(R.drawable.ic_clear_white_24dp);
}
}
示例10: initToolbar
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
/**
* Initialize the toolbar.
*/
private void initToolbar() {
final Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
}
}
示例11: 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();
}
示例12: initActionBar
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
protected ActionBar initActionBar(ActionBar ab, int titleId, int subtitleId) {
if (ab != null) {
ab.setElevation(100);
ab.setDisplayHomeAsUpEnabled(true);
ab.setHomeButtonEnabled(true);
ab.setTitle(titleId);
if (subtitleId != 0) {
ab.setSubtitle(subtitleId);
}
}
return ab;
}
示例13: initWindow
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
protected void initWindow() {
super.initWindow();
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(false);
}
}
示例14: onCreate
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
setContentView(R.layout.activity_panic_preferences);
}
示例15: enableHomeUp
import android.support.v7.app.ActionBar; //导入方法依赖的package包/类
protected void enableHomeUp() {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
}