Feed Buzzard
  • General
  • Tech
  • World Tech
  • World Tech Code
  • Wearable Tech
  • Pokemon
  • About Us
    • Terms & Conditions
    • Privacy Policy
  • Contact
No Result
View All Result
  • General
  • Tech
  • World Tech
  • World Tech Code
  • Wearable Tech
  • Pokemon
  • About Us
    • Terms & Conditions
    • Privacy Policy
  • Contact
No Result
View All Result
Feed Buzzard
No Result
View All Result
Home World Tech

Android CollapsingToolbarLayout Title background –

Gordon James by Gordon James
January 6, 2021
in World Tech
0
0
SHARES
2
VIEWS
Share on FacebookShare on Twitter

Development issue/problem:

I work with the CollapsingToolbarLayout program of the new Android Design Support Library.

I installed it and it works fine, the only problem I have left is that the text is lost when scrolling, depending on the background image.

What I would like to do is set the background of the CollapsingToolbarLayout header, but I haven’t found a way to do it yet.

Is there anything to make that happen?

Classification:

Configure the header of CollapsingToolbarLayout in the activity :

CollapseToolbarLayout collapseToolbar =
(CollapseToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapseToolbar.setTitle(A title here;)

Edit:

Here you can see the screen order when I remove the toolbar. You can see that the header is unreadable. The problem is that I have no control over the images shown, so for some images it looks good and for others, like this example, it looks bad and can’t be read. What I meant was that you might want to add some kind of background for the text, so that the back of the text is always the same color and it’s always legible.

How can I solve this problem?

Solution 1:

Use the text protection scream (scroll down a bit). My example assumes that the title text is white, and that some nuance may be needed to optimize it in your case.

Add in your CollapsingToolbarLayout the following after ivBigImage :

Add to the Drawable folder :

scrim_top.xml

and scrim_bottom.xml

For the paints you have to make these shades when you test them for the first time, so it is more obvious that it works, but for the production, I used :

#260000
#0C0000
#2A000000
#0D00000000

And for the dimensions I used a height of 88 inches.

Solution 2:

Use the text saver from the Amagi82 example and add the app:expandedTitleTextAppearance parameter to the CollapsingToolbarLayout.

For example, add the following to your xml style:

Solution 3:

Edit:

If you want to change the color of the toolbar after it has been resized, you must lower the contentScrim attribute in the layout of the toolbar to this color:

If you set the value of this attribute to the color for which you want to change the toolbar, it will solve your problem, as I understand it.

I hope it answers your question!

Solution 4:

It takes a lot of work to write such a large piece of code.
I’ve accomplished this in two ways.

1 Easy bypass thanks to the transparent black appearance
CODE>>.

Explanation of the code :
1 The CollapsingToolbarLayout style only has the text size.
2 By default, the value in the lower field CollapsingToolbarLayout is replaced by 16dp.
3. Our head with Parallax collapseMod is RelativeLayout with ImaveView and View.
4. This single view with BG at the bottom of the top relative title of the layout with a contrasting color (here #770000), serves as BG for the reduced title of CollapsingToolbarLayout in white.

Images for Style 1 :

a) CollapseToolbarLayout completely reduces the title of the layout:

b) If you delete ToolbarLayout, the title will be compressed when scrolling up:

Abbreviation

2 Reply above

The method has already been mentioned by João Ferreira.

This is what it looks like with shadowRadius=16: Watch out for The Shadow.

Give here a description of the image

PS, please update or ask for more information in case of confusion.

Good luck!

Related Tags:

collapsingtoolbarlayout android example,android collapsing toolbar,android collapsing toolbar with image,android collapsing toolbar with search,how to change background color of collapsing toolbar in android,android collapsing toolbar with custom toolbar,collapsing toolbar with navigation drawer android example,how to set title in collapsing toolbar

Total
0
Shares
Share 0
Tweet 0
Pin it 0
Share 0
Gordon James

Gordon James

James Gordon is a content manager for the website Feedbuzzard. He loves spending time in nature, and his favorite pastime is watching dogs play. He also enjoys watching sunsets, as the colors are always so soothing to him. James loves learning about new technology, and he is excited to be working on a website that covers this topic.

Related Posts

Blockchain Conference in Poland Showcases New Solutions to Problems in Enterprise Logistics
World Tech

Blockchain Conference in Poland Showcases New Solutions to Problems in Enterprise Logistics

December 15, 2022
World Tech

Rockstar Games Brings GTA to The Metaverse

October 20, 2022
World Tech

Ways Technology Is Changing The World Of Education

September 21, 2022
Next Post

Suunto vs Garmin GPS Sports Watch: Which One is Best?

How to configure gradle to work “offline” (using cached dependencies) –

Update error 0x8024001e on Windows 10 [Easy Guide]

No Result
View All Result

Recommended

5 Useful Things You Can Do With cURL and Proxies

1 hour ago
Here’s Everything You Need to Know about Moles

Here’s Everything You Need to Know about Moles

2 days ago

Comic Play Casino Games

1 week ago

Here is a List of Some of the Most Interesting Slots You Can Play

1 week ago

Categories

  • Fitness Trackers
  • General
  • Latest
  • Pokemon
  • Tech
  • Technology and Computing
  • Wearable Tech
  • World Tech
  • World Tech Code

Recent Posts

  • 5 Useful Things You Can Do With cURL and Proxies January 27, 2023
  • Here’s Everything You Need to Know about Moles January 25, 2023
  • Comic Play Casino Games January 20, 2023
  • Here is a List of Some of the Most Interesting Slots You Can Play January 20, 2023

Categories

  • Fitness Trackers
  • General
  • Latest
  • Pokemon
  • Tech
  • Technology and Computing
  • Wearable Tech
  • World Tech
  • World Tech Code

© 2022 FeedBuzzard.com

No Result
View All Result
  • General
  • Tech
  • World Tech
  • World Tech Code
  • Wearable Tech
  • Pokemon
  • About Us
    • Terms & Conditions
    • Privacy Policy
  • Contact

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT