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


Java CollapsingToolbarLayout.setTitleEnabled方法代碼示例

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


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

示例1: onCreate

import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_show);
    extractDataFromIntent();

    imageView = (ImageView) findViewById(R.id.backdrop);
    collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapse_toolbar);
    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    viewPager = (ViewPager) findViewById(R.id.viewpager);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setTitle(showTitle);
    }
    if (tabLayout != null) {
        tabLayout.setupWithViewPager(viewPager);
    }
    collapsingToolbar.setTitleEnabled(false);
    setUpImageView();
    setupViewPager();
}
 
開發者ID:chashmeetsingh,項目名稱:TrackIt-Android,代碼行數:25,代碼來源:ShowActivity.java

示例2: onCreate

import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_blog_posts);

    Intent intent = getIntent();
    blogName = intent.getStringExtra("blog_name");
    blogBundle = new Bundle();
    blogBundle.putString("blog_name", blogName);

    Toolbar toolbar = findViewById(R.id.toolBar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(blogName);
    }
    CollapsingToolbarLayout collapsingToolbarLayout = findViewById(R.id.collapsingToolbar);
    collapsingToolbarLayout.setTitleEnabled(false);

    postListFragment = new PostListFragment();
    postListFragment.setArguments(blogBundle);
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    ft.add(R.id.fragment_container, postListFragment);
    ft.commit();

    followBlogPresenter = new FollowBlogPresenter(this);
    presenter = new PostPresenter(null);
    postListFragment.setPresenter(presenter);

    setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
 
開發者ID:mingdroid,項目名稱:tumbviewer,代碼行數:33,代碼來源:PostListActivity.java

示例3: onCreate

import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_likes);
    Toolbar toolbar = findViewById(R.id.toolBar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();

    Bundle bundle = getIntent().getBundleExtra("bundle");
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        if (bundle == null) {
            actionBar.setTitle(getString(R.string.page_user_like));
        } else {
            actionBar.setTitle(getString(R.string.likes_title, bundle.getString("blog_name")));
        }
    }
    CollapsingToolbarLayout collapsingToolbarLayout = findViewById(R.id.collapsingToolbar);
    collapsingToolbarLayout.setTitleEnabled(false);

    LikesFragment likesFragment = new LikesFragment();
    likesFragment.setArguments(bundle);

    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    ft.add(R.id.fragment_container, likesFragment);
    ft.commit();

    setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
 
開發者ID:mingdroid,項目名稱:tumbviewer,代碼行數:30,代碼來源:LikesActivity.java

示例4: setToolbar

import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
public void setToolbar() {
    CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout)findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setContentScrimColor(ContextCompat.getColor(this, R.color.colorPrimary));
    collapsingToolbar.setTitle(getString(R.string.movie_details));
    collapsingToolbar.setCollapsedTitleTextAppearance(R.style.CollapsedToolbar);
    collapsingToolbar.setExpandedTitleTextAppearance(R.style.ExpandedToolbar);
    collapsingToolbar.setTitleEnabled(true);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
}
 
開發者ID:boyangyuu,項目名稱:ILoveMovie,代碼行數:13,代碼來源:MovieDetailsActivity.java

示例5: onCreateView

import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_user_info, container, false);
    arguments = getArguments();
    email = arguments.getString(EMAIL_BUNDLE_KEY);
    phone = arguments.getString(PHONE_BUNDLE_KEY);
    website = arguments.getString(WEBSITE_BUNDLE_KEY);
    fullName = arguments.getString(FULL_NAME_BUNDLE_KEY);
    presenter.setUserId(arguments.getLong(ID_BUNDLE_KEY));

    Toolbar toolbar = (Toolbar) view.findViewById(R.id.user_toolbar);
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(toolbar.getContext(),
            null, android.support.v7.appcompat.R.styleable.ActionBar, android.support.v7.appcompat.R.attr.actionBarStyle, 0);
    toolbar.setNavigationIcon(a.getDrawable(android.support.v7.appcompat.R.styleable.ActionBar_homeAsUpIndicator));
    toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed());

    toolbarLayout = (CollapsingToolbarLayout) view.findViewById(R.id.user_collapsing_toolbar_layout);
    emailTextView = (TextView) view.findViewById(R.id.user_info_email_value);
    phoneTextView = (TextView) view.findViewById(R.id.user_info_phone_value);
    websiteTextView = (TextView) view.findViewById(R.id.user_info_website_value);
    userInfoFab = (FloatingActionButton) view.findViewById(R.id.user_info_fab);
    toolbarLayout.setTitleEnabled(true);
    toolbarLayout.setTitle(fullName);

    view.findViewById(R.id.user_info_email_layout).setOnClickListener(this);
    view.findViewById(R.id.user_info_phone_layout).setOnClickListener(this);
    view.findViewById(R.id.user_info_website_layout).setOnClickListener(this);
    userInfoFab.setOnClickListener(this);

    if (presenter.isCurrentUser()) {
        userInfoFab.setVisibility(View.GONE);
    }

    packageManager = getActivity().getPackageManager();

    return view;
}
 
開發者ID:ukevgen,項目名稱:BizareChat,代碼行數:39,代碼來源:UserInfoFragment.java

示例6: onCreate

import android.support.design.widget.CollapsingToolbarLayout; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);
    rootView = (CoordinatorLayout) findViewById(R.id.rootview);
    setupToolbar(R.id.toolbar, "DESSERTS", android.R.color.white, android.R.color.transparent, R.drawable.ic_arrow_back);

    collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbarLayout.setTitleEnabled(false);

    recyclerView = (RecyclerView) findViewById(R.id.recyclerShopping);

    mAdapter = new ShoppingAdapter(generateShopping(), this);
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    recyclerView.setLayoutManager(mLayoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(mAdapter);

    recyclerViewPreparation = (RecyclerView) findViewById(R.id.recyclerPreparation);

    mAdapterPreparation = new PreparationAdapter(getBaseContext(), generatePreparation(),this);
    LinearLayoutManager mLayoutManagerPreparation = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    recyclerViewPreparation.setLayoutManager(mLayoutManagerPreparation);
    recyclerViewPreparation.setItemAnimator(new DefaultItemAnimator());
    recyclerViewPreparation.setAdapter(mAdapterPreparation);

    recyclerViewComments = (RecyclerView) findViewById(R.id.recyclerComment);

    mAdapterComments = new CommentsAdapter(generateComments(), this);
    LinearLayoutManager mLayoutManagerComment = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    recyclerViewComments.setLayoutManager(mLayoutManagerComment);
    recyclerViewComments.setItemAnimator(new DefaultItemAnimator());
    recyclerViewComments.setAdapter(mAdapterComments);


    final ImageView imageComment = (ImageView) findViewById(R.id.iv_user);
    Glide.with(this)
            .load(Uri.parse("https://randomuser.me/api/portraits/women/75.jpg"))
            .transform(new CircleGlide(this))
            .into(imageComment);

    final ImageView image = (ImageView) findViewById(R.id.image);
    Glide.with(this).load(Uri.parse("https://images.pexels.com/photos/140831/pexels-photo-140831.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb")).into(image);

}
 
開發者ID:ahmadnurhidayat,項目名稱:Cook-It-Android-XML-Template,代碼行數:46,代碼來源:Detail.java


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