Java Code Examples for android.support.v7.app.ActionBar.setIcon()

The following are Jave code examples for showing how to use setIcon() of the android.support.v7.app.ActionBar class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: freehkkai-android   File: MainActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_container_adview);
	ButterKnife.bind(this);
	setSupportActionBar(toolbar);

	ActionBar ab = initActionBar(getSupportActionBar(), R.string.app_name);
	ab.setIcon(R.mipmap.ic_launcher);
	ab.setDisplayHomeAsUpEnabled(false);
	ab.setHomeButtonEnabled(false);

	adView = C.initAdView(mContext, adLayout);

	Fragment fragment = new MainFragment();
	FragmentManager fragmentManager = getSupportFragmentManager();
	fragmentManager.beginTransaction()
			.replace(R.id.container, fragment)
			.commit();
}
 
Example 2
Project: boohee_v5.6   File: BrowserSuccessHistoryActivity.java   Source Code and License Vote up 6 votes
public void onCreate(Bundle outState) {
    super.onCreate(outState);
    setContentView(R.layout.dh);
    this.mTitle = getIntent().getStringExtra("title");
    if (!TextUtils.isEmpty(this.mTitle)) {
        setTitle(this.mTitle);
    }
    this.mUrl = getIntent().getStringExtra("url");
    if (TextUtils.isEmpty(this.mUrl)) {
        Helper.showToast((CharSequence) "无效的链接");
        finish();
        return;
    }
    ActionBar actionBar = getSupportActionBar();
    actionBar.setIcon((int) R.drawable.s7);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    initView();
}
 
Example 3
Project: Neuronizer   File: AppbarCustomizer.java   Source Code and License Vote up 5 votes
public static void configureAppbar(Activity activity, boolean showBackArrow) {
    ActionBar actionBar = ((AppCompatActivity) activity).getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayUseLogoEnabled(!showBackArrow);
        actionBar.setDisplayShowHomeEnabled(!showBackArrow);
        actionBar.setDisplayHomeAsUpEnabled(showBackArrow);
        if (!showBackArrow) actionBar.setIcon(R.mipmap.ic_launcher);
    }
}
 
Example 4
Project: android-media-controller   File: MediaAppControllerActivity.java   Source Code and License Vote up 5 votes
private void setupToolbar(String name, Bitmap icon) {
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        final Bitmap toolbarIcon = BitmapUtils.createToolbarIcon(getResources(), icon);
        actionBar.setIcon(new BitmapDrawable(getResources(), toolbarIcon));
        actionBar.setTitle(name);
    }
}