本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}