Java Code Examples for android.support.design.widget.CollapsingToolbarLayout#setCollapsedTitleTextColor()

The following examples show how to use android.support.design.widget.CollapsingToolbarLayout#setCollapsedTitleTextColor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NoteinfoActivity.java    From Memory-capsule with Apache License 2.0 6 votes vote down vote up
private void initToolbarSeting(){//toolbard的设置
    toolbar=(Toolbar)this.findViewById(R.id.toolbar_noteinfo);
    coordinatorLayout_noteinfo=(CoordinatorLayout)this.findViewById(R.id.coordinator_noteinfo);
    setSupportActionBar(toolbar);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            finish();
        }
    });
    CollapsingToolbarLayout collapsingToolbarLayout=(CollapsingToolbarLayout)findViewById(R.id.cool_noteinfo);
    collapsingToolbarLayout.setExpandedTitleColor(Color.WHITE);
    collapsingToolbarLayout.setCollapsedTitleTextColor(Color.WHITE);
}
 
Example 2
Source File: InnerQuestionActivity.java    From nono-android with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void registerWidget() {
    question_answer_num = findView(R.id.question_answer_num);
    socialBar = findView(R.id.socialBar);
    innerQuestionDetailRender =$(R.id.inner_question_detail);
    inner_question_raiser_head_image = findView(R.id.inner_question_raiser_head_image);
    inner_question_raiser_head_image.setOnClickListener(this);
    question_inner_user_name = findView(R.id.question_inner_user_name);
    inner_question_list_item_is_sameuniversity = findView(R.id.inner_question_list_item_is_sameuniversity);
    inner_question_list_item_is_sameschool = findView(R.id.inner_question_list_item_is_sameschool);
    notice_btn = findView(R.id.notice_btn);
    notice_btn.setOnClickListener(this);
    question_inner_raise_time = findView(R.id.question_inner_raise_time);
    collapseToolBar =(CollapsingToolbarLayout) findViewById(R.id.collapseToolBar);
    collapseToolBar.setCollapsedTitleTextColor(getResources().getColor(R.color.md_text));
    collapseToolBar.setExpandedTitleTextAppearance(R.style.questionDetailCollapseStyle);

   // pull_card_fab = findView(R.id.pull_card_fab);
    question_detail_card_view = findView(R.id.question_detail_card_view);
    voteBtn=(VoteButton)findViewById(R.id.inner_question_detail_vote_tooltip_trigger);
    voteBtn.setOnClickListener(this);
    answerBtn = findView(R.id.add_answer);
    answerBtn.setOnClickListener(this);
}
 
Example 3
Source File: MainActivity.java    From android-apps with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

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

    CollapsingToolbarLayout collapsingToolbar =
            (CollapsingToolbarLayout) findViewById(R.id.collapse_toolbar);
    collapsingToolbar.setTitle("My Toolbar Tittle");

    collapsingToolbar.setCollapsedTitleTextColor(getResources().getColor(R.color.colorAccent));
    collapsingToolbar.setExpandedTitleColor(getResources().getColor(R.color.colorPrimaryDark));
}
 
Example 4
Source File: AboutUsActivity.java    From WanAndroid with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle bundle) {
    LightStatusbarUtils.setLightStatusBar(this,false);
    super.onCreate(bundle);
    setContentView(R.layout.activity_about_us);
    CollapsingToolbarLayout mCollapsingToolbarLayout = findViewById(R.id.collapsingbarlayout);
    Toolbar mToolbar = findViewById(R.id.toolbar);
    mToolbar.setTitle(R.string.about_us);
    setSupportActionBar(mToolbar);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    //设置展开后的字体颜色
    mCollapsingToolbarLayout.setExpandedTitleTextColor(ColorStateList.valueOf(ContextCompat.getColor(this,R.color.white)));
    //设置收缩后的字体颜色
    mCollapsingToolbarLayout.setCollapsedTitleTextColor(ColorStateList.valueOf(ContextCompat.getColor(this,R.color.white)));
    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    mVersionView =  findViewById(R.id.version);
    mIntroduceView =  findViewById(R.id.introduce);
    setVersion();
    setIntroduce();

}
 
Example 5
Source File: BaseDetailDelegate.java    From CoreModule with Apache License 2.0 5 votes vote down vote up
@Override
public Toolbar getToolbar() {
    super.getToolbar();
    Toolbar toolbar = get(R.id.toolbar);
    CollapsingToolbarLayout collapsingToolbar = get(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle(rootView.getResources().getString(R.string.blog_detail));
    int titleColor = rootView.getResources().getColor(android.R.color.white);
    collapsingToolbar.setCollapsedTitleTextColor(titleColor);
    collapsingToolbar.setExpandedTitleColor(titleColor);
    return toolbar;
}
 
Example 6
Source File: GroupDetailActivity.java    From citrus with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_group_detail);
    ButterKnife.bind(this);
    Toolbar toolbar = findById(this, R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    setupFloatingActionButton();

    Intent intent = getIntent();
    mGroupName = intent.getStringExtra(KEY_GROUP_NAME);

    CollapsingToolbarLayout collapsingToolbar = findById(this, R.id.collapsing_toolbar);
    collapsingToolbar.setTitle(mGroupName);
    collapsingToolbar.setCollapsedTitleTextColor(getResources().getColor(android.R.color.white));
    collapsingToolbar.setExpandedTitleColor(getResources().getColor(android.R.color.white));

    ImageView headerImageView = findById(this, R.id.backdrop);
    GroupHelper.setupDefaultGroupImage(mGroupName, headerImageView);

    mListsFragment = ListsFragment.newInstance(mGroupName);
    FragmentManager manager = getSupportFragmentManager();
    manager.beginTransaction()
            .replace(R.id.group_detail_container, mListsFragment)
            .commit();
}
 
Example 7
Source File: Talk.java    From mConference-Framework with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_talk);

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

    final TalkDetails talkDetails = (TalkDetails)getIntent().getSerializableExtra("TalkDetails");
    final Drawable upArrow = ContextCompat.getDrawable(this, R.drawable.abc_ic_ab_back_mtrl_am_alpha);
    upArrow.setColorFilter(ContextCompat.getColor(this, android.R.color.white), PorterDuff.Mode.SRC_ATOP);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
    getSupportActionBar().setHomeAsUpIndicator(upArrow);

    collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.talk_toolbar_layout);
    collapsingToolbarLayout.setTitle(talkDetails.getName());
    collapsingToolbarLayout.setExpandedTitleColor(ContextCompat.getColor(this, android.R.color.white));
    collapsingToolbarLayout.setCollapsedTitleTextColor(ContextCompat.getColor(this, android.R.color.white));

    final ImageView talkImage = (ImageView) findViewById(R.id.talk_collapsible_image);
    TextView talkTime = (TextView) findViewById(R.id.talk_time_detail);
    TextView talkLocation = (TextView) findViewById(R.id.talk_venue_detail);
    TextView talkDesc = (TextView) findViewById(R.id.talk_desc_detail);

    SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm a");
    String talkTimeText = dateFormat.format(talkDetails.getStartTime())
            + " - " + dateFormat.format(talkDetails.getEndTime());
    talkTime.setText(talkTimeText);

    talkLocation.setText(talkDetails.getLocation());
    talkDesc.setText(talkDetails.getDesc());

    Picasso.with(this)
            .load(Uri.parse(talkDetails.getImageURL()))
            .error(R.drawable.placeholder_1)
            .fit().centerCrop().into(talkImage, new com.squareup.picasso.Callback() {
        @Override
        public void onSuccess() {
            applyPalette(talkImage);
        }

        @Override
        public void onError() {
            Log.d("Talk.java", "Error caused by Picasso");
            applyPalette(talkImage);
        }
    });

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.talk_reminder);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_EDIT);
            intent.setType("vnd.android.cursor.item/event");
            intent.putExtra(CalendarContract.Events.TITLE,
                    talkDetails.getName());
            intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,
                    talkDetails.getStartTime().getTime());
            intent.putExtra(CalendarContract.Events.EVENT_LOCATION,
                    talkDetails.getLocation());
            intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME,
                    talkDetails.getEndTime().getTime());
            intent.putExtra(CalendarContract.Events.ALL_DAY, false);
            intent.putExtra(CalendarContract.Events.DESCRIPTION,
                    talkDetails.getShortDesc());
            v.getContext().startActivity(intent);
        }
    });
}