private void setupToolbar() {
    mCollapsingToolbarLayout.setExpandedTitleColor(Color.WHITE);
    mCollapsingToolbarLayout.setCollapsedTitleTextColor(Color.WHITE);

    setSupportActionBar(mToolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
      actionBar.setDisplayHomeAsUpEnabled(true);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mr__activity_book_info);

    mToolbar = (Toolbar) findViewById(R.id.mr__abi_toolbar);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    mCollapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.mr__abi_collapsing_tool_bar);
    mCollapsingToolbar.setTitle("My Toolbar Tittle");
    mCollapsingToolbar.setCollapsedTitleTextColor(Color.WHITE);
    mCollapsingToolbar.setExpandedTitleColor(Color.WHITE);
    mCollapsingToolbar.setContentScrimColor(getResources().getColor(R.color.os__primary_color));
    mCollapsingToolbar.setExpandedTitleTextAppearance(R.style.mr__ExpandedAppbarStyle);
    mCollapsingToolbar.setCollapsedTitleTextAppearance(R.style.mr__CollapsedAppbarStyle);

    initViews();
  }
Esempio n. 3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    toolbar = (Toolbar) findViewById(R.id.MyToolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapse_toolbar);

    collapsingToolbar.setCollapsedTitleTextColor(getResources().getColor(R.color.white));
    collapsingToolbar.setExpandedTitleColor(getResources().getColor(R.color.white));
    //        collapsingToolbar.setContentScrimColor(getResources().getColor(R.color.mColor));
    Drawable drawable = getResources().getDrawable(R.drawable.background_toolbar);
    collapsingToolbar.setContentScrim(drawable);

    txtC = (TextView) findViewById(R.id.txtC);
    txtStt = (TextView) findViewById(R.id.txtStt);
    txtDate = (TextView) findViewById(R.id.txtDate);
    txtHumidity = (TextView) findViewById(R.id.txtHumidity);
    txtWind = (TextView) findViewById(R.id.txtWind);
    txtSunrise = (TextView) findViewById(R.id.txtSunrise);
    txtSunset = (TextView) findViewById(R.id.txtSunset);
    layout = (LinearLayout) findViewById(R.id.weatherToolbar);

    Intent i = new Intent(MainActivity.this, FetchAddressIntentService.class);
    startService(i);
    FragmentManager fragmentManager;
    FragmentTransaction fragmentTransaction;
    fragmentManager = getFragmentManager();
    fragmentTransaction = fragmentManager.beginTransaction();
    ViewFragment fragment = new ViewFragment();
    fragmentTransaction.add(R.id.mFrame, fragment, "sometag");
    fragmentTransaction.commit();
    //        if (savedInstanceState == null) {
    //            getFragmentManager().beginTransaction().add(R.id.mFrame, new
    // ViewFragment()).addToBackStack(null).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).commit();
    //        }
  }