<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Suleiman Shakir on Medium]]></title>
        <description><![CDATA[Stories by Suleiman Shakir on Medium]]></description>
        <link>https://medium.com/@suleiman19?source=rss-83858f711e05------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yY6UxIV_qOqJPQn1eCpYMw.jpeg</url>
            <title>Stories by Suleiman Shakir on Medium</title>
            <link>https://medium.com/@suleiman19?source=rss-83858f711e05------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 18:18:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@suleiman19/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I use AI to partner on design problems]]></title>
            <link>https://uxdesign.cc/how-i-use-ai-to-think-through-design-problems-4a484080484b?source=rss-83858f711e05------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a484080484b</guid>
            <category><![CDATA[ai-design]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[product-design]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[design-thinking]]></category>
            <dc:creator><![CDATA[Suleiman Shakir]]></dc:creator>
            <pubDate>Mon, 11 May 2026 22:51:31 GMT</pubDate>
            <atom:updated>2026-05-12T16:39:20.747Z</atom:updated>
            <content:encoded><![CDATA[<h4>A design workflow where AI holds the context, I do the thinking: from brainstorm to prototype</h4><p>Working through a complex design problem means holding a lot in my head. Research synthesis, product metrics, a Slack thread with stakeholder feedback, Figma comments, decisions made in the last iteration. Multiply that across iterations, and it’s hard to keep up.</p><p>Most AI tools push toward visual generation. Faster UI, pretty mockups, vibe-coded prototypes. It’s fast, and it looks good. But it skips the hard part. I always thought design was about solving problems.</p><p>So what if AI could help me think through the problem instead? Hold all of the project’s context and surface the right piece at the right moment. Something that compounds context over a project’s life. Like a <a href="https://practicalpie.com/memory-palace-simple-guide/">mind palace</a>?</p><figure><img alt="GIF of Sherlock Holmes from the BBC series, navigating his mind palace — a visual metaphor for how the AI design system stores and retrieves project context" src="https://cdn-images-1.medium.com/max/583/0*xIh-BpAXnbsIzevZ" /></figure><p>Once set up, I can go from a well-defined problem to a few data-informed code prototypes quickly. Not vibe-coded UI. Concepts grounded in the actual problem and project context. And I’m not using regular AI chat or <a href="https://claude.com/resources/tutorials/intro-to-projects">Projects</a>.</p><figure><img alt="Diagram of my AI-assisted design workflow showing how project context informs conversations with AI and its outputs. Left side of the image shows my conversation with Claude Code, right side shows a browser window with data-informed prototypes that Claude Code built" src="https://cdn-images-1.medium.com/max/1024/1*gCrZmCDPAhvnKrH4wry80w.png" /><figcaption>The system at a glance: project context in, grounded design decisions out.</figcaption></figure><p>I’ll walk through it using Beacon - a fictional local discovery app with made-up research, personas, and one design problem: users bouncing before the data loads. The data and examples aren’t real. The setup is. Sample project is on GitHub, linked at the bottom.</p><h3>Giving AI the full picture</h3><p>Project context is scattered across different documents, tools and people. Research lives in one place, product metrics in another, stakeholder feedback in Slack threads I missed. Every design session starts with manual context reassembly. So I built a memory bank out of it. Then I taught <a href="https://claude.com/product/claude-code">Claude Code</a> to use it.</p><pre>my-project/<br>  .claude/ ← skills live here<br>  data/ ← research synthesis &amp; metrics (I started with this folder!)<br>  design/ ← per-feature folders (round-1/, round-2/, … for explorations + feedback)<br>  project-context/ ← frozen project details (PRD, goals, etc.)<br>  handoffs/ ← eng specs<br>  prototypes/ ← working HTML prototypes<br>  design-system/ ← tokens &amp; components<br>  CLAUDE.md ← project instructions<br>  MEMORY.md ← persistent context index</pre><p>CLAUDE.md <a href="https://claude.com/blog/using-claude-md-files">customizes Claude Code</a> for this project. MEMORY.md is the running index of all context, data, and decisions. Think of it as a table of contents that keeps evolving. When Claude needs information, this file tells it <em>where</em> to look.</p><p>design-system/ makes prototypes feel like the real product. My setup is simple: <a href="https://www.designtokens.org/tr/2025.10/format/#introduction">design tokens</a> (spacing, color, typography) as CSS variables. The goal at this stage is validating flows and UX, not visual accuracy. I could wire up this project to my design system code, but setup felt time-consuming.</p><p>I store all project information as <a href="https://www.markdownguide.org/getting-started/">markdown</a>. They’re consistently formatted so AI can retrieve it better. Raw notes are fine going in. Claude can help shape them. Anything confidential, I obfuscate first.</p><figure><img alt="Screenshot of Claude Code running via terminal in Cursor, showing a conversation with AI where I ask it the status of a design task" src="https://cdn-images-1.medium.com/max/1024/1*dAW4NSweP4hucU6fz8MYnA.png" /><figcaption>Asking AI the status of a project. Using Claud Code via Terminal in Cursor</figcaption></figure><p>I run Claude Code via Terminal in <a href="https://cursor.com/">Cursor</a>. Any IDE showing multiple files works (like VS Code). I need to see the files AI touches. Don’t want any hallucinations creeping in!</p><p>The Terminal looks intimidating. But using Claude there feels like regular AI chat with more power. I can open a new Terminal tab and run another Claude instance. Using Claude Code via the desktop app could work too but I haven’t tried it. Recently I’ve been using <a href="https://www.warp.dev/">Warp</a> to manage multiple agents and get notified when they’re done. Pick an approach you’re comfortable with!</p><h3>Automating my process</h3><p>Once the project had all its context, I noticed another problem. I kept re-explaining the same workflows: “Read the ticket, check research, give me three directions” every time. So I automated them with <a href="https://claude.com/skills">Skills</a>.</p><figure><img alt="Example of a skill — Explore. An ochestrator skill which calls upon other skills to thread through a design problem with you from definition to prototypes" src="https://cdn-images-1.medium.com/max/1024/1*hjA73HVnSsAOtzoa4cTIPw.png" /><figcaption>Explore calls upon other skills to thread through a design problem with you — from definition to prototypes</figcaption></figure><p>Skills are documented workflows turned into single commands. <a href="https://github.com/anthropics/skills">Anthropic skills</a> and others are worth using, but <a href="https://claude.com/docs/skills/how-to">creating custom ones</a> tuned to my needs worked best. Here’s what I landed on.</p><ul><li>explore: helps go through an entire design iteration. I give it a problem: a ticket, a brief, or statement and it kicks off an iteration, cross-referencing available data and generates code prototypes for each.</li><li>brainstorm: for working out which directions are worth pursuing</li><li>synthesize: takes new raw data and integrates it correctly into the project. Also helps connect new findings to existing data.</li><li>prototyping: builds self-contained code prototypes grounded in the design system.</li><li>design-partner: highly personalized to how I work. I use it to pressure-test a direction against my own standards and project goals.</li></ul><p>Highly recommend taking the time to tweak these skills to your working style, especially design-partner.</p><h4>Connecting to live data</h4><p>As projects evolve, new context surfaces first in meetings or tools like Slack, Figma or Linear. I’d rather stay immersed in the problem. So I lean on <a href="https://modelcontextprotocol.io/introduction">MCPs</a> (Model Context Protocol) to pull information from these tools. Setup takes time with authentication and permissions. But once running, it stays out of the way.</p><p><a href="https://linear.app/docs/mcp"><strong>Linear</strong></a><strong><br></strong>When the problem lives in a ticket, I point /explore at it so Claude can gather context, read the latest activity, and also help keep it updated.</p><p><a href="https://help.figma.com/hc/en-us/articles/32132100833559-Guide-to-the-Figma-MCP-server"><strong>Figma</strong></a><strong><br></strong>Claude references mocks to generate accurate prototypes. Figma MCP writes to the canvas too which is useful. The more structured the Figma, the better it works. I’ve found great results giving Claude a well-defined, scoped section of mocks versus the entire file link.</p><p><a href="https://docs.figma-console-mcp.southleft.com/"><strong>Figma Console MCP</strong></a><strong><br></strong>Lets my project learn the design system from Figma libraries instead of wiring up a codebase. Extracts richer layer data than a screenshot. If code extraction isn’t an option, this helps get it from your Figma libraries.</p><p><a href="https://tools.slack.dev/mcp/"><strong>Slack</strong></a> <br>Stakeholder feedback, new decisions, timeline shifts hit Slack before they hit any ticket. Teaching Claude where to look keeps it (and me) current.</p><p>All of these are optional. My project started with none of them. I wanted it working on its own first. MCPs came later, as I noticed patterns in my workflow worth automating. More connections means more things that can break so there’s a balance.</p><h3>In practice</h3><p>One /explore run is the start, not the finish. Most problems take several iterations. I’ve noticed that the more clear I am, the fewer back and forth I have with AI.</p><figure><img alt="Diagram showing the /explore skill triggering a chain of sub-skills — from problem definition through brainstorming and prototyping" src="https://cdn-images-1.medium.com/max/1024/1*t-MODs2LWnmYuGq_Q_JzTg.jpeg" /><figcaption>/explore chains brainstorm, synthesize, and prototyping skills into one command. One prompt kicks off a full iteration.</figcaption></figure><p>AI surfaces directions I use as starting points. Those proposals are far from sharing or shipping. So I have it surface relevant data points. But I steer what it needs to build. I’ll take over with Figma mocks if needed to help it along.</p><p>A typical session. Some commands are skills, some natural language. I talk to it like a collaborator. No re-explaining. It knows the project.</p><pre>Where did I leave this project? What should I focus on next?<br><br><strong>/explore</strong> the loading states problem<br><br><strong>/design-partner</strong> evaluate the latest loading states solutions<br><br><strong>/synthesize</strong> stakeholder feedback for revision 2: [raw feedback copy-pasted]<br><br>My latest iteration for loading states is complete. Post an update. (it&#39;ll send a Slack message and Linear comment if MCP works)</pre><p>Between commands is the actual design work. Sketching, reasoning, spec docs, forming a point of view before I bring Claude back in. This may even mean quick mocks in Figma./design-partner pressure-tests my thinking against the problem.</p><p>Once I lock in directions, Claude builds them as code prototypes. Rough on purpose. To align on direction is the goal, not polish. Before anything goes to the team, I validate it against the original problem statement (/design-partner can help).</p><figure><img alt="Example of a Claude Code session where Claude helps evaluate proposals against exisiting data and goals. Using /critique or /design-partner skills to evaluate my latest concepts" src="https://cdn-images-1.medium.com/max/1024/1*GulAf2UN32O2LTp7fqygxw.png" /><figcaption>A session where Claude helps evaluate proposals against exisiting data and goals</figcaption></figure><p><strong>Note:</strong> I always check the AI’s sources. It knows to pull only from existing project data but can still hallucinate. When it cites research to justify a decision, I verify the source.</p><h3>Handoff</h3><p>Once aligned on a prototype, I design Figma mocks for key moments in the flow. Then I write a spec describing the flow: the steps, with Figma frames for the key ones.</p><figure><img alt="Animated screen recording showing Claude generating a high-fidelity prototype or spec document from a written handoff spec and Figma frames" src="https://cdn-images-1.medium.com/max/1024/1*tF-xcg9AKKKmgwwHop903g.gif" /><figcaption>Once the spec is written, Claude has an anchor to generate different outputs from it — high-fidelity prototype, journey map, or implementation plan</figcaption></figure><p>Writing out the solution is also context for AI. It becomes the anchor for everything else. Claude can use it to build a high-fidelity prototype, write a journey map, generate an implementation plan for code. It’s also what stops it from hallucinating, especially with complex flows.</p><h3>What changed</h3><p>I stopped starting over. Every session picked up where the last one left off with decisions, dead ends, all of it. I could go from a well-defined problem to clickable prototypes fast. Context switching dropped. I could stay in the problem.</p><p>Code prototypes changed the feedback dynamic. Unlike static Figma mocks, they weren’t polished and yet that helped. People stopped picking at visual details and started talking about UX. That’s the conversation I want earlier. Bad ideas die faster too, before I’ve invested much.</p><p>I track decisions per round in the design/ folder. No more digging through Figma comment threads to remember why we made a call three weeks ago. Syncing stakeholders stopped feeling like project management. Claude reads the Linear tickets, Slack threads, and latest research. I don&#39;t manually summarize. It already knows.</p><figure><img alt="File explorer showing the design folder with round-by-round subfolders containing explorations, feedback, and decision logs" src="https://cdn-images-1.medium.com/max/1024/1*cWl3VmT4Cf-8Hp77tWy6zA.png" /><figcaption>Summarizing every round or iteration to inform future explorations</figcaption></figure><p>The longer the project ran, the more useful it got. Early decisions became context for later ones.</p><h3>Where this could go</h3><p><strong>Prototyping with code components. </strong>Once I have a spec, rough prototype, and key Figma frames, Claude writes an implementation plan. I give that to my codebase and it builds a <a href="https://storybook.js.org/">Storybook</a> prototype using the design system. Real code that my engineers could use. I’ve had a fair amount of success with this. <a href="https://www.anthropic.com/news/claude-design-anthropic-labs">Claude Design</a> might make it easier but haven’t spent enough time with it yet.</p><p><strong>Proactive context maintenance:</strong> Claude is already connected to Linear, Slack, and Figma. Right now I manually feed it updates. I’ve started with a /tidy skill for cleanup and maintenance, but the next step is surfacing a diff: &quot;here&#39;s what&#39;s new since you were last here.&quot; New ticket comments, a Slack thread with an eng constraint, an updated Figma frame. The biggest tax in this setup is keeping context fresh. This would make it passive.</p><p><strong>Post-ship feedback loop:</strong> The cycle ends at handoff. If I connected analytics, Claude could compare live performance against the original goals. “Bounce during load dropped from 38% to 22% after the receipt pattern shipped.” That closes the loop. I’d know which design decisions worked without pulling dashboards.</p><h3>Caveats</h3><p>There’s quite a few, I won’t lie. But the benefits far outweigh the cons for me to even complain.</p><p><strong>Upfront investment is real.</strong> Organizing project context takes time. I built it piece by piece. The structure is both powerful and fragile. Claude helps maintain it, but I must know what goes in. Incorrect or stale data meant hallucinated outputs.</p><p><strong>It doesn’t replace thinking.</strong> The project’s greatest strength is recall and synthesis, not outsourced judgment. Claude does the synthesis work: retrieves the research, matches patterns, frames the initial tradeoffs. I do the design thinking. I’ve never shipped a direction without reshaping it because often times its suggestions can be quite terrible. But it does offer a good starting point.</p><p><strong>Complex concepts need structured input.</strong> A 12-step prototype from a written prompt alone will create drift. Key states mocked in Figma plus a spec document keep AI’s output anchored.</p><p><strong>It amplifies blind spots.</strong> If my research only covers one persona, every recommendation cites that same source. It makes gaps obvious.</p><p><strong>Context grows faster than it compresses.</strong> As a project runs longer, the memory bank grows: more rounds, more decisions, more data files. At some point there’s too much for a session to hold cleanly. I manage it by archiving old rounds, keeping MEMORY.md lean, starting new chats often (/clear and /compact were my friends)</p><p><strong>Prototype sharing feels rudimentary.</strong> The prototypes were interactive and fast to get feedback on. My team was super into it. But sharing a zip file isn’t an elegant Figma link. No annotated comments or canvas sometimes made it tricky to gauge feedback via Slack or Linear comments.</p><p><strong>Knowing when to take over.</strong> Sometimes it works flawlessly that my jaw-drops. It one-shots my intent perfectly. But sometimes it won’t get the simplest of things right, despite my constant prompts and prayers to the AI gods. That gets tiring. AI gets me 80% of the way. Then I jump to Figma to take it to completion. Otherwise, its diminishing returns. Its also why I’m not chasing high-fidelity concepts with AI (yet).</p><h3>Closing thoughts</h3><p>At two months in (at the time of writing), I’m still finding the edges. But long enough to see it work well. Engineering and product were already moving faster. This is how I can keep pace where AI handles the recall, I handle the judgment.</p><p>I didn’t need AI to crank out pretty UI. I needed it to hold more so I could think clearer. That’s what this does, most of the time.</p><h4>Starter kit</h4><p>Try it yourself on GitHub : <a href="https://github.com/Suleiman19/ai-design-buddy"><strong>https://github.com/Suleiman19/ai-design-buddy</strong></a></p><ul><li>/sample has Beacon pre-loaded with fake data, research, and skills. Good place to explore before committing to your own setup.</li><li>Run /explore on result cards to see a full iteration kick off.</li><li>Starting fresh on your own project? Delete /sample first.</li></ul><p>It’s early and opinionated. Expect it to change.</p><p>Building something similar or approaching this differently? I’d love to hear about it! Reach out on <a href="https://www.linkedin.com/in/suleiman-shakir/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a484080484b" width="1" height="1" alt=""><hr><p><a href="https://uxdesign.cc/how-i-use-ai-to-think-through-design-problems-4a484080484b">How I use AI to partner on design problems</a> was originally published in <a href="https://uxdesign.cc/">UX Collective</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Join BuzzFeed as a Product Design Intern]]></title>
            <link>https://medium.com/buzzfeed-design/join-buzzfeed-product-design-internship-60c339128120?source=rss-83858f711e05------2</link>
            <guid isPermaLink="false">https://medium.com/p/60c339128120</guid>
            <category><![CDATA[ux-design]]></category>
            <category><![CDATA[buzzfeed]]></category>
            <category><![CDATA[product-design]]></category>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[user-experience]]></category>
            <dc:creator><![CDATA[Suleiman Shakir]]></dc:creator>
            <pubDate>Fri, 28 Feb 2020 16:26:47 GMT</pubDate>
            <atom:updated>2020-02-28T16:26:47.255Z</atom:updated>
            <content:encoded><![CDATA[<h4>We’re hiring two interns this summer!</h4><p>Deciding what kind of internship you want is hard. Large companies give you a glimpse of how Product Design is practiced at scale. Startups are more hands-on, providing opportunities to have a more direct impact with your work.</p><p>Product Design at BuzzFeed offers the best of both worlds. You’ll be an important member of a fast-moving product team that values your ideas, working on projects that impact millions of people.</p><p>Also, as a part of the Product Design team, you’ll be:</p><ul><li>Working with a dedicated design mentor throughout the program</li><li>Presenting work and receiving feedback via weekly critique sessions</li><li>Brainstorming solutions with other designers</li><li>Collaborating across Product, Engineering, Data Science and other teams</li></ul><h4><a href="https://boards.greenhouse.io/buzzfeed/jobs/2107245?gh_jid=2107245"><strong>Apply to BuzzFeed’s Product Design Internship</strong></a></h4><p>Being a part of <a href="https://www.buzzfeed.com/montanar49316ea17/20-reasons-no-internship-will-ever-be-better-than-2g2cw?utm_term=.rdxo6nrp2Q#.lyDp7Q8Y2q">BuzzFeed’s Intern Program</a> means you won’t be alone! You’ll get to meet and work with a bunch of interns across Tech and beyond.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oeeMDTJO0S82NjpcZn_YWA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oq3a_WbViMi8mhu68Wi15w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JcHbc3b_mUoODi4i0mlhsQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LfEeqldAZEfwAL0EkkLkYw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*n8TxkGdrttp5kDwtOTExig.gif" /><figcaption>Some of our amazing BuzzFeed interns from 2017, 2018, and 2019</figcaption></figure><p>Over the summer, interns will participate in Hack Week, Product Design team outings and other fun events with BuzzFeed at large.</p><p>At BuzzFeed, we work on a lot of problems at scale but also know how to have fun. Free lunch twice a week, leftovers from the Tasty kitchen, and other exciting intern events are just some of the things you can expect!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FwAxlCmeX1ri1y%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fromy-dance-dancing-snoop-dogg-wAxlCmeX1ri1y&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FwAxlCmeX1ri1y%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/41d624ee6488d9df23f970a5140074cd/href">https://medium.com/media/41d624ee6488d9df23f970a5140074cd/href</a></iframe><h3>The Hiring Process</h3><h4>1. Application Review</h4><p>We will be reviewing applications as we receive them. We’ll be evaluating you based on <a href="https://github.com/buzzfeed/design/blob/master/product-design-roles.md#associate_product_designer">similar criteria we look for in Associate Product Designers</a>. Once we’ve shortlisted potential candidates, we’ll reach out with interview requests.<strong> </strong>For this internship, we’re only considering Product Designers because the role requires having demonstrated User Interface and User Experience work for digital products.</p><h4><strong>2. Teamwork &amp; Collaboration Interview</strong></h4><p>Our initial conversation will last about 45 minutes and will <strong>focus on getting to know you, seeing how you collaborate and work with others, and understanding your skillset</strong>. We’ll ask you about your experience collaborating with other disciplines, like engineers, data scientists, and product managers. If you haven’t worked with these disciplines before, tell us about how you’ve worked in a team.</p><p>We’ll also tell you about the product design team, and what it’s like to be on a team at BuzzFeed. This conversation will happen with a BuzzFeed product designer over video chat.</p><h4><strong>3. Portfolio Review</strong></h4><p>For those who are successful in their first interview, you’ll have another 45-minute conversation with a member of the product design team over video chat. We’ll ask you to walk us through 2–3 projects that you’ve worked on in the past.</p><p><strong>We want to see not only the final product but also the messy parts of the process.</strong> What did you try that didn’t work? What variations did you come up with before narrowing down it to the final design? What parts of the work generated friction or disagreement with your team or other stakeholders? Did you run experiments? If so, what did you learn?</p><p>These projects can be from school, past internships, or self-initiated. Don’t worry if you didn’t have teammates or stakeholders on your projects, that’s ok, we’re most interested in understanding your design and communication skills.</p><h4><strong>4. Finalizing candidates</strong></h4><p>Following these interviews, we will regroup to compare notes and finalize the most well-suited candidates. Once we find a good fit, we’ll send out offers!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fvmon3eAOp1WfK%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fcelebration-excited-loki-vmon3eAOp1WfK&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fvmon3eAOp1WfK%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="323" frameborder="0" scrolling="no"><a href="https://medium.com/media/10e202f2ce3eb47a27339099bcdf2d33/href">https://medium.com/media/10e202f2ce3eb47a27339099bcdf2d33/href</a></iframe><p>Whether you get an offer or not, you’ll hear back from us to let you know we’ve reached the end of our process.</p><p>Currently, we’re accepting Product Design Intern applications for Summer 2020. If you can see the link below, you can still apply! Applying early is encouraged as we will close the process when we find the right fit.</p><p><strong>You can </strong><a href="https://boards.greenhouse.io/buzzfeed/jobs/2107245?gh_jid=2107245"><strong>apply here</strong></a><strong>.</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fl1J3CbFgn5o7DGRuE%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fl1J3CbFgn5o7DGRuE%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExbG51YTI0ZmU3ZTI1OGx2ZGVjY3h4NmJhYTJjeHFuOGZsOGQ1bTd4eiZlcD12MV9naWZzX2dpZklkJmN0PWc%2Fl1J3CbFgn5o7DGRuE%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="281" frameborder="0" scrolling="no"><a href="https://medium.com/media/5fa8f4266a7202d18b96ad7d41b42eef/href">https://medium.com/media/5fa8f4266a7202d18b96ad7d41b42eef/href</a></iframe><p><em>Thanks to my colleague, </em><a href="https://medium.com/u/21c212a05669"><em>Alex Gervais</em></a><em> for co-authoring this article with me!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60c339128120" width="1" height="1" alt=""><hr><p><a href="https://medium.com/buzzfeed-design/join-buzzfeed-product-design-internship-60c339128120">Join BuzzFeed as a Product Design Intern</a> was originally published in <a href="https://medium.com/buzzfeed-design">BuzzFeed Design</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use Empty States to your Advantage]]></title>
            <link>https://uxdesign.cc/use-empty-states-to-your-advantage-1ba760cd739f?source=rss-83858f711e05------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ba760cd739f</guid>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[design-thinking]]></category>
            <category><![CDATA[user-experience]]></category>
            <category><![CDATA[ux]]></category>
            <dc:creator><![CDATA[Suleiman Shakir]]></dc:creator>
            <pubDate>Tue, 25 Jul 2017 03:40:16 GMT</pubDate>
            <atom:updated>2017-10-31T02:27:38.149Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using Empty States to your Advantage</h3><h4>How to prevent your app from losing half its users in a month</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*gK0U_Rsi4Z6LEE3uxC0yww.png" /></figure><p>Empty States are often neglected and designed last. I don’t blame you though. After all, compared to the main screens, these aren’t important. Right?</p><p>Sadly, no. The worst that can happen is that users can uninstall your app after first use. Trust me, you don’t want that to happen.</p><blockquote><em>Users who uninstall your app after first-use are most likely to never return.</em></blockquote><p>Mostly, empty state screens are ignored until the app is done. Then, you realize that a particular screen could be empty at some time. So you just throw in a little error message like this and call it a day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/1*eaO_-8kGyyKZlXueTCrRIA.jpeg" /><figcaption><em>iOS Pages app — I’m not sure where it’s asking me to tap…</em></figcaption></figure><p>This is NOT okay! Once users reach an empty state screen, they might not know what to do. Or they simply might move on to another screen, or worse, another app.</p><p>The gravity of the situation is worse than you think! Here’s a wake-up call.</p><blockquote><em>The average app mostly loses its entire user base within a few months. — </em><a href="https://www.linkedin.com/pulse/losing-80-mobile-users-normal-why-best-apps-do-better-andrew-chen"><em>Andrew Chen (Growth at Uber, LinkedIn Influencer)</em></a></blockquote><p>First, let’s clarify what an empty state is. Then, we’ll see why it must be given importance. Next, let’s find out when it can occur and how to tackle them. Finally, we’ll see how to design effective Empty States.</p><h3>What are Empty States?</h3><p>I’ll spare you the boring book definition here.</p><blockquote><em>Empty State or zero-data state is what a user sees when there is no data to display on-screen.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/1*xUFeUhSDgT-61kAWlN7LNQ.png" /><figcaption><em>Image credit: emptystat.es</em></figcaption></figure><h4>Why Bother?</h4><p>We need to make sure that users learn the purpose of a particular screen. If it’s a news app, and there is no news to display, tell them why.</p><p>Well, that might sound ironic. But what if the network call fails?</p><p>The reality is that 77% of users will uninstall your app in 3 days! Only the top 10–50 apps are able to break that and keep more users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s69ubIDjby_XARbT.png" /></figure><p>You might say these are extreme statistics but think again.</p><h4>The difficulty of User Retention</h4><p>Let me put that in perspective for you.</p><p>You use apps too right? Say you want to try out a news app. I’m sure you don’t download just one, but at least a couple of them.</p><p>Then, you give each app a try. You try to see which one is good. Finally, you keep what you like and you uninstall the rest.</p><blockquote><em>Users try out a lot of apps but decide which ones they want to ‘stop using’ within the first 3–7 days — Ankit Jain, Google.</em></blockquote><p>Get it? That might happen to your app as well. Hence you need to use everything at your disposal to keep your users.</p><p>Once they start using your app, do your best to make them stay. Empty States are the perfect opportunity to do so.</p><p>Use them to encourage interaction, reinforce your brand and increase user loyalty. I know such terms might sound cheesy. But if you use Empty States correctly, your app adoption rates will be much higher. In other words, that translates to lesser app uninstalls.</p><blockquote><em>The best way to bend the retention curve is to target the first few days of usage, and in particular the first visit — Andrew Chen</em></blockquote><p>When are most of the empty states visible? During the first few days of using the app.</p><p>Now you know what needs to be done. Let’s see when Empty States can occur and how to best design them.</p><p><strong>Here’s another user-retention technique</strong> — <a href="http://blog.iamsuleiman.com/stop-using-loading-spinner-theres-something-better/">Use Skeleton Screens make your app appear faster</a>.</p><h3>When can Empty States occur?</h3><p>Now that we know about Empty States and its importance, let’s see when it can actually occur.</p><p>To put it simply, it occurs whenever there is an absence of data.</p><p>Yes, that’s just straight from the definition, but the exact scenarios are as follows:</p><ol><li>for first-time users</li><li>when an error occurs</li></ol><p>Let’s look at them in depth.</p><h4>1. For first-time users</h4><p>Empty States can serve as an onboarding for first-time users. Yes, you don’t have to do those forced, carousel-like product tours!</p><p>Let’s take the example of the <a href="https://play.google.com/store/apps/details?id=com.google.android.keep&amp;hl=en">Google Keep</a> Android app. It handles Empty States for first-time users in a unique way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/0*4HvSZ58eqAje6cru.png" /><figcaption>Google Keep — Empty State</figcaption></figure><p>It displays ‘<em>starter content</em>’ to familiarize users with its app. Typically, when you open a note-taking app, it would be empty. You don’t know how a bunch of notes will appear on-screen. You’ll have to create a couple of them to find out.</p><p>Instead, Keep does that for you. So although you don’t have any notes, it creates a few, showing how it works.</p><p>With this, first-time users are educated on 2 things:</p><ol><li>how notes work within the app</li><li>learn about the app’s features</li></ol><p>That’s pretty smart, right? It works extremely well for them. We’ll talk more about ‘starter content’ later into this article.</p><p>For apps like notes, email, bookmark managers and others, there is no content, to begin with! Users will have to manually start creating to populate them. Such apps are gold mine opportunities for having Empty States for first-time users.</p><p>But keep in mind that you have to think about individual screens rather than the entire app.</p><p>For example, a news app might show worldwide news by default on the home screen. So no worries there.</p><p>What if it had a bookmarks feature? Then you’d have a screen that shows all the bookmarked news. But unless the user has bookmarked at least one news article, that screen would be empty. So that’s an Empty State too. How would you handle that?</p><h4>2. When an error occurs…</h4><p>Now for some apps, even if you’re a new user, there will be some content to display. Say that the app makes an API call to fetch content, and for some reason, it fails.</p><p>When a new user opens your app and goes to the home screen, you don’t want that to happen. It doesn’t tell the user anything. What is the user supposed to understand and do on that screen?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/0*Nu71RV0W8bf-k31K.jpg" /><figcaption>Safari iOS app — No internet state. Image credit: tympanus.net</figcaption></figure><p>That is just one scenario. This could happen to ANY screen. Make sure you handle that as well.</p><p><strong>Tell users why it failed</strong></p><p>This is perhaps the most important thing to remember. When you’re showing an Empty State in the event of an error, tell users what happened.</p><p>Make sure you tell users what the issue is, without going too technical. For example, let’s assume, your app’s servers overloaded and crashed due to traffic surge.</p><p>If that’s the scenario, don’t get too technical and spam them with crash logs and error codes. That’s for your developers, not users! An appropriate error message could say “Our servers are currently busy”.</p><p>Chrome balances information and detail very well. It even adds a bit of humor to it. It has a brilliant empty state that not only tells us what’s wrong. But also suggests how to fix the problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/0*qyGT2YM9zdWhvqHG.png" /><figcaption>Android Chrome App — Offline State</figcaption></figure><p>Here’s what Chrome achieves with this design.</p><ol><li><strong>Error message </strong>— A generic error message that everyone can understand</li><li><strong>Solution </strong>— Suggests steps to resolve the error</li><li><strong>Error code</strong> — for the tech savvy?</li><li><strong>‘Download Page Later’</strong>— automatically download page for viewing when the internet is back on</li><li><strong>T-Rex game</strong> — it’s actually a game you can play to kill time until your internet comes back</li></ol><p><strong>FUN FACT:</strong> <a href="https://www.quora.com/Why-does-Google-Chrome-show-a-dinosaur-when-you-are-offline">Why Google Chrome shows a dinosaur when offline?</a></p><p>Here’s another example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*42uNxoahKw-SevoqgUfANA.jpeg" /><figcaption><a href="https://dribbble.com/shots/2530692-Empty-States"><em>Desk Empty States by YiJing Z — Dribbble</em></a></figcaption></figure><p>Remember that not every scenario is the same. This would have already become evident to you. For example, for a retry page load, it makes sense to have a retry button. But what about an email app with an empty Spam screen?</p><p>Now that’s clear, we can see how to actually design it.</p><h3>How to Design Empty States?</h3><blockquote><em>To make blank slate useful, consider inserting quick tutorials, videos, help tips, call to action-elements, screenshot of the page when it is in “normal” stage — anything that helps the user and makes him happy with your app. — </em><a href="http://patternry.com/p=blank-slate/"><em>Patternry</em></a></blockquote><p>Here is a couple of tips on how to design effective Empty States. Let’s go through them one at a time.</p><h4>1. Be informative</h4><p>When an empty state occurs, it is visible to the user. Tell them why they’re seeing this screen.</p><p>When a user sees an empty state, 2 things should be conveyed.</p><ol><li>Purpose of the screen (what can I expect to see here?)</li><li>Why am I currently seeing an empty state?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/0*YMUAw4F1VWZvsqP3.jpg" /><figcaption>Dropbox favorites. Image credit: tympanus.net</figcaption></figure><p>Copy in design is very powerful. It effectively communicates what users need to know. The lesser the words used, the better.</p><p>If you read carefully, the copy answers both those questions above. It tells us:</p><ol><li>What is this screen?</li><li>What’s the use of marking a file as a ‘favorite’?</li></ol><h4>2. Handle Failure States — Don’t scare your users</h4><p>If it’s an error, tell them what went wrong. Take it a step further by suggesting how to resolve the error. Remember the Google Chrome example?</p><p>Here’s what you can do with Empty States for an error:</p><ul><li>show a non-technical copy for error text</li><li>suggest possible steps to resolve the error (as simple and short as possible)</li><li>Don’t use technical jargon that can confuse users</li><li>Allow them to reload (retry loading a page)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/1*osYNmA4cHNrP9TC-zufyNg.png" /><figcaption><em>Image credit: emptystat.es</em></figcaption></figure><h4>3. Encourage Users to take action</h4><p>A simple, yet highly-effective way to get users to interact, is to use a <strong>CTA (Call-to-Action)</strong>.</p><blockquote><em>A call-to-action (usually abbreviated as CTA) is an image or line of text that prompts your visitors, leads, and customers to take action. It is, quite literally, a “call” to take an “action.” — </em><a href="https://blog.hubspot.com/marketing/what-is-call-to-action-faqs-ht"><em>blog.hubspot.com</em></a></blockquote><p>In other words, for our apps, CTAs are buttons. Big bold, attention-hogging buttons. When a user sees a screen, the should immediately be able to see that CTA (button). That’s what makes it effective.</p><p>Material Design provides us with a Floating Action Button. That’s a perfect candidate for a CTA!</p><p>Some examples would be a note-taking app. Prompt first-time users to add a new note by using a CTA button. Or a recipe app, where the CTA is to add a new recipe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*qJ5wRRJiWTFMk1w1quiUeg.png" /><figcaption><a href="https://dribbble.com/shots/1738412-Project-empty-state"><em>Marvel App — Project empty state by Murat Mutlu — Dribbble</em></a></figcaption></figure><p>Yet for some screens, there is simply nothing to do. Example, Gmail Spam screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/0*ME5pP5zlE96V6WOC.png" /><figcaption>Gmail App — Spam</figcaption></figure><h4>4. Display Starter Content</h4><p>Remember the Google Keep app? We spoke about it as an example for Empty States. That’s called Starter Content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*hRkgNPZw6XIIMnZq.png" /><figcaption>Evernote app — starter content for first-time users</figcaption></figure><p>With this, 2 goals can be achieved.</p><ol><li>Help familiarize users with how notes work</li><li>Use these ‘starter content’ notes to flaunt the app’s features</li></ol><p>Take Twitter. Every new user needs to follow few people to get started. In this way, no new user’s home feed is going to be empty. This can also be seen as a way of Twitter reinforcing what it’s all about.</p><h4>5. Stick to your brand — be consistent</h4><p>You might have a lot of freedom when designing Empty States. But make sure you stick to your brand.</p><p>By that I mean, make sure you stick to your styleguide and color palette. The last thing you want is a screen that feels alien within your entire app.</p><p>Alright, this might not be a design tip that’s specific to Empty States. But even so, it is still important. It’s easy to get carried away!</p><p>For example, if your brand color is blue. For the sake of emphasis, don’t make your Empty State’s CTA button red! Agreed that you might want to emphasize an alert or danger. But don’t do it at the cost of inconsistency.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcards.uplabs.com%2Fcards%2F80676%2Fpost%3Fv%3D1&amp;url=https%3A%2F%2Fwww.uplabs.com%2Fposts%2Fcourse-dashboard-application&amp;image=https%3A%2F%2Fassets.materialup.com%2Fuploads%2Faf402218-1060-4068-bcbc-99c2168dab7e%2Fpreview.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=uplabs" width="480" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/88a8e0668d82fc1733c4ab728449d79f/href">https://medium.com/media/88a8e0668d82fc1733c4ab728449d79f/href</a></iframe><h4>6. Use Humor</h4><p>Sometimes, humor can play a big role in damping down the seriousness of an issue.</p><p>A great example of using humor in design is Mailchimp. They know how well to design it so that it engages the user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*m9BrVPx-uyIMQN5zM9H1iQ.jpeg" /><figcaption><strong>Mailchimp</strong> — what users see after sending a campaign. <em>Image </em>credit<em>: </em><a href="https://www.smashingmagazine.com/2016/06/complete-roadmap-building-delightful-onboarding-experience-mobile-app-users/"><em>smashingmagazine.com</em></a></figcaption></figure><p>So before you use humor, make sure it’s in the right context. For example, a good place to use it would be content not found screens (empty search results).</p><p>On the contrary, a bad place to use it would be in an error state. Say a failed task. It’s worse if the error was on your part.</p><blockquote><em>Using humour is fun and is a welcome relief. But also think of scenarios when a customer comes to your site to complain, or they have a problem with your product or service. They may not be in the best mood and that humorous message could be a tipping point for a customer to leave permanently. — </em><a href="https://www.spotless.co.uk/insights/using-humour-in-ux/"><em>spotless.co.uk</em></a></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcards.uplabs.com%2Fcards%2F54638%2Fpost%3Fv%3D1&amp;url=https%3A%2F%2Fwww.uplabs.com%2Fposts%2Fempty-state-concepts-infused-with-personality&amp;image=https%3A%2F%2Fassets.materialup.com%2Fuploads%2F3f852021-6242-4fa8-a1d8-decca32de7e1%2Fpreview.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=uplabs" width="480" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/612ba7b80d692646e8462d726579c5cc/href">https://medium.com/media/612ba7b80d692646e8462d726579c5cc/href</a></iframe><h4>7. Keep it simple</h4><p>Arriving at the last design tip, this is the most important one to remember.</p><p>With all the tips mentioned above, it’s easy to include everything and go overboard! Don’t do that.</p><blockquote><em>Remember that simple designs are always more effective.</em></blockquote><p>Here’s a great empty state interaction. It’s lovely, but it’s also so fancy. If my app is simple and not animation-heavy, I wouldn’t attempt anything like this, just for an Empty State!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcards.uplabs.com%2Fcards%2F22785%2Fpost%3Fv%3D1&amp;url=https%3A%2F%2Fwww.uplabs.com%2Fposts%2Fempty-state-eb2dc951-27ef-4b4c-af8a-c490e01a1431&amp;image=https%3A%2F%2Fassets.materialup.com%2Fuploads%2Feb124ad7-5953-441c-a2ce-d98e97d823b8%2Fpreview.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=uplabs" width="480" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/dbc166c0fdd6c1e9042fc235aef8e5a4/href">https://medium.com/media/dbc166c0fdd6c1e9042fc235aef8e5a4/href</a></iframe><p>An Empty State is supposed to be a lightweight screen. If there is an action to be performed, make sure it’s just one. Don’t offer many points of interaction on a single empty state! That’s just confusing.</p><h3>Takeaway</h3><p>To summarize everything, Empty States are an excellent opportunity to engage with users. It might seem insignificant in the larger picture. But even the smallest of things matter.</p><blockquote><em>Attention to detail matters because when you show that you care about the small details, people trust you to care about the big ones. — </em><a href="https://ux.shopify.com/empty-states-more-like-you-have-no-idea-how-much-work-goes-into-those-states-amirite-e0102f58b64e"><em>Meg Robichaud (Shopify UX)</em></a></blockquote><p>User retention with apps is already very hard. So use every chance you have to keep them. Because once they leave, it’s difficult to get them back.</p><blockquote><em>Remember that no screen should be a dead-end for your users!</em></blockquote><h4>Wrap up</h4><p>Keeping these simple design tips in mind will help you create effective Empty States:</p><ol><li><strong>Be informative</strong> — tell users why they’re seeing this screen</li><li><strong>Handle failure</strong> — tell why the error occurred and suggest a fix</li><li><strong>Use a CTA</strong> — encourage users to take action</li><li><strong>Consider Starter Content</strong> — great way to familiarize users with your app</li><li><strong>Be consistent</strong> — stick to your brand’s design guidelines</li><li><strong>Use Humour</strong> — reduce the seriousness of an issue. Use carefully</li><li><strong>Keep it simple</strong> — nothing over the top. Remember simple = effective.</li></ol><p>I hope this article will help you design better, effective Empty States. Use them to your advantage for better user retention!</p><p>Lastly, if you need some design inspiration, these resources have you covered.</p><ul><li><a href="http://emptystat.es/">emptystat.es</a></li><li><a href="https://pttrns.com/?scid=30">pttrns.com</a></li><li><a href="http://ui-patterns.com/patterns/BlankSlate/examples">ui-patterns.com</a></li></ul><p>Thanks for reading!</p><p><em>Originally published at </em><a href="http://blog.iamsuleiman.com/empty-states-advantage-user-retention/"><em>blog.iamsuleiman.com</em></a><em> on July 25, 2017.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff%2F50d69a%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F50d69a%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/05d5fd32eda31cbd1b83287606744532/href">https://medium.com/media/05d5fd32eda31cbd1b83287606744532/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ba760cd739f" width="1" height="1" alt=""><hr><p><a href="https://uxdesign.cc/use-empty-states-to-your-advantage-1ba760cd739f">Use Empty States to your Advantage</a> was originally published in <a href="https://uxdesign.cc/">UX Collective</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best Practices for Horizontal Lists in Mobile]]></title>
            <link>https://uxdesign.cc/best-practices-for-horizontal-lists-in-mobile-21480b9b73e5?source=rss-83858f711e05------2</link>
            <guid isPermaLink="false">https://medium.com/p/21480b9b73e5</guid>
            <category><![CDATA[ux-design]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[design-thinking]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Suleiman Shakir]]></dc:creator>
            <pubDate>Tue, 09 May 2017 13:15:32 GMT</pubDate>
            <atom:updated>2018-06-04T16:32:48.288Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7wA2Fg1RDWtLs6m0Hv_XrQ.png" /></figure><p>Many Android and iOS apps have horizontal scrolling lists. Maybe it’s also combined inside a vertical list. But is it necessary? Even assuming it is, are you doing it right?</p><p>In this article, let’s discuss tips to remember when designing horizontal lists. Later, we’ll look at possible alternatives that can work better.</p><p>So first off, why horizontal lists on mobile?</p><blockquote><em>Horizontal lists are better-suited for mobile, as it supports both horizontal and vertical gestures.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/0*fbygZ5xkEtvE7I5C.jpeg" /><figcaption>Netflix iOS app</figcaption></figure><p>Yet, people including you and me both, mostly scroll vertically. I mean seriously, what’s the first natural thing you do, when you open an app? You scroll. Vertically.</p><p>Okay, maybe you check your notifications first. But even there, you scroll. Vertically.</p><p>So how do you tell people that they can also scroll horizontally? But before that, when should we use horizontal scrolling?</p><h3>When to use Horizontal Lists</h3><blockquote><em>Horizontal lists work best when you want to display a subset of homogeneous content that’s part of a heterogeneous set.</em></blockquote><p>Makes sense?</p><p>Take the Play Store app for Android. Sure the Play Store is all about finding new apps. But for us to search better, apps need to be categorized don’t they?</p><p>For example, you can subcategorize apps into games, utility and social, to name a few. Hence each of these apps can be categorized in a horizontal list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*Y-0yzJUkT0LQr0-sV7nwbA.png" /><figcaption>Google Play Store app on Android</figcaption></figure><p>As you can see, Play Store gives us an assortment of apps. There’s a bunch of ‘Recommended’ apps you can browse (horizontally). Then, there’s a set of apps that are ‘New+Updated’.</p><p>So to go by definition, each subcategory of apps are in a horizontal list. These child lists are put into a (parent) vertical list.</p><p>You can scroll horizontally to see more of a subcategory. You can scroll vertically to see more subcategories.</p><p>The iTunes app on iOS is another brilliant example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*YVKlXD_7IyEKj1YI1Et75Q.jpeg" /><figcaption>iTunes app on iOS</figcaption></figure><h3>Design Tips for Horizontal lists on Mobile</h3><p>In the web, arrows show that there is a horizontal list of content you can scroll. This is typically a carousel. It uses a combination of arrows for navigation, dots for indication and scrollbars. These are indicators that tell people how to navigate a carousel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mTWpp9IgJg3cGxiONKYShg.png" /><figcaption>Carousel — as seen on Flipkart website</figcaption></figure><p>Okay, I said for mobile. But I showed you how it’s done on the web, and for good reason.</p><p>Now that you’ve seen the web version, that’s how you must NOT design for mobile. Mobile apps are touch-based and support gestures. Would you still be using point and click mechanisms such as arrows? I’m sure not.</p><p>Moreover, given mobile size constraints, using the same web paradigms makes little sense. So there must be a better way. But still, expect users to scroll the same way they would in a vertical list.</p><p>Here are some design tips to keep in mind. They can help you make better and effective horizontal lists.</p><h4>1. Show Visual Indicators</h4><p>Assume you’re displaying a horizontal list of cards. You’d want the last card on the right, to <strong>peek out</strong> from the edge.</p><blockquote>The design must leave a visual hint that a set of content is horizontally scrollable.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*j5bSXlxD7tcipkFy.png" /><figcaption>Horizontal Lists with the last visible item ‘peeking’ from the edge</figcaption></figure><p>So for this particular device width, we can show two cards. To see the third card and beyond, we need to scroll horizontally.</p><p>Notice the design teases a bit of the third card. Yes, the pink cards at the extreme ends that are partially hidden. This ‘tease’ provides a subtle hint that there’s more content.</p><p>Since the flow of content is horizontal, it naturally indicates users in which direction to scroll. Hence, the user’s natural instinct is to scroll in that direction (horizontally).</p><h4>2. Use a ‘See More’ Button</h4><p><em>See More, See All, View All, View More, Show More …</em></p><p>Call the button what you want. Essentially, it should mean one thing:</p><blockquote><em>A ‘See More’ button tells users there’s more of where that came from. It’s hinted that there’s more of similar content available.</em></blockquote><p>Keep in mind, that each subcategory (horizontal list), is just a tease of what kind of content you can expect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*uwC0rDxPr1q9-lHkBBLMKQ.png" /><figcaption>Using a vertical, 3-column grid in ‘See All’ screen</figcaption></figure><p>So when a user taps on “See More”, you want to show them all that’s there to show for that subcategory. For example, assume the user clicks the subcategory called “Top Action Games” in the Play Store app. Then the ‘See All’ screens shows all the best action games in that subcategory.</p><p>Remember that vertical scrolling is the most natural and fastest.</p><blockquote><em>Vertical scrolling increases the user’s ability to skim through content</em></blockquote><p>Hence, it makes sense to use a vertical grid in the ‘See All’ screen.</p><h4>3. Design for Responsiveness</h4><p>Keep in mind that mobile app interfaces are responsive. So make sure that the subtle hint of ‘peeking’ is always present. Otherwise, you might see a horizontal list that looks like a grid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*3NFbOUrcLphAiX0f.png" /><figcaption>Horizontal lists that look like a grid</figcaption></figure><p>So tell me. From the UI above, can you tell that each subcategory is a horizontal list? Moreover, can you even tell if it’s horizontally scrollable? I’m sure not.</p><p>But you’re not to blame. It’s the design’s fault. There is NO visual indication!</p><p>Trust me, that’s not what you want people seeing. The whole list looks just like a vertical grid. If it looks like that, then every user’s natural instinct is to vertically scroll.</p><h4>4. Adapting Horizontal lists for Tablets</h4><p>So how do you design horizontal scrolling lists on larger devices such as Tablets?</p><p>One way is to convert your horizontal list into a grid with N items per row. The UI design below displays five items per row. With a ‘See All’ button that indicates that a user can see more content like this, on a new screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*qFdorMZvndvT1eRJwZAG-A.png" /><figcaption>Horizontal Lists as a grid on Tablet</figcaption></figure><p>Hence, on mobile, it can be a scrollable horizontal list of say, ten cards. However on Tablets, you could have five or six, non-scrollable cards.</p><h4><strong>5. Limit horizontal content on tablets</strong></h4><p>Tablets grant larger screen width. So it’s wise to take advantage of large screen real-estate.</p><p>But let’s focus on just horizontal scrolling for a moment. It’s perfectly fine on mobile. You show three items by default. The rest is can be viewed by scrolling horizontally. This means that the additional content which is hidden, is optional to view, left to the discretion of the user. If users are interested, they can scroll to see more. Or if they want to see all of it, they can tap the ‘See More’ button.</p><p>Now let’s get back to Tablets. Your natural instinct would be to simply show more content horizontally. It totally makes sense to do so. When a larger width is available, it’s natural to make use of it. Right?</p><p>No. Let me tell you why.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*e3rdKxAQ6L9mxWANmrC9lg.png" /><figcaption>Don’t stretch horizontal lists on Tablets</figcaption></figure><p>Giving a ‘tease’ of five to six contents is more than enough to tell people what to expect from a category. Remember that the user may scroll horizontally to see more. But they definitely will scroll vertically. Moreover, if they want to see everything a category has to offer, they can tap the ‘See All’ button.</p><p>Hence, it makes sense to just show a non-scrollable grid of five to six items per subcategory. Giving too many choices is a sign of increased cognitive load for users. That’s not a good thing.</p><blockquote><em>Every time you visit a website, a process of learning is initiated. Your brain has to learn how to use the site while keeping track of the reason you came there in the first place. The mental effort required during this time is called </em><strong><em>cognitive load</em></strong><em>. — </em><a href="https://jonyablonski.com/2015/design-principles-for-reducing-cognitive-load/"><em>Design Principles for Reducing Cognitive Load</em></a><em>.</em></blockquote><p>Alright, that may be in the context of a website. But it all the more holds true on mobile. Attention span on mobile is shorter than you think and <a href="http://www.telegraph.co.uk/science/2016/03/12/humans-have-shorter-attention-span-than-goldfish-thanks-to-smart/">an article by The Telegraph</a> agrees too!</p><p>Remember that tablets have larger widths. Use that extra space to allow your designs to breathe a little.</p><h4>6. Snap Horizontal Scrolling</h4><p>This is a technique that prevents freeform scrolling. Although not entirely. Here’s a GIF that will explain it better.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/0*b0rJgYB6OEUFCnZp.gif" /><figcaption>Snap scrolling in horizontal list</figcaption></figure><p>Can you see horizontal scrolling is snapped? Whenever the user scrolls horizontally, the next item becomes slightly visible. This is a subtle hint that even after scrolling, there’s more content available.</p><p>Although this is hardly noticeable, it’s a great tip to keep in mind. It is a very subtle, yet powerful hint that indicates whether there is more content or not.</p><h4>7. Indicate the start and end of a list</h4><p>Agreed that when the scrolling stops, we know we’ve reached the end of the list. But unless we scroll, we don’t know, do we?</p><p>Android uses a neat animation to denote the end of a list. But that’s only when the user scrolls. Which means the user finds out AFTER they have scrolled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*Tos60fQHFU_ooohx.png" /><figcaption>Image Credits: <a href="http://stackoverflow.com/questions/35148954/react-native-android-how-to-change-the-color-of-listview-end-of-scroll-animat">Stack Overflow</a></figcaption></figure><p>But what if we could make it better? Would you want your users to scroll to find out? Wouldn’t it be better if you could visually indicate that too?</p><blockquote>Use extra spacing to denote the start and end of a list.</blockquote><p>This approach works well for horizontal lists too. Add extra spacing to the extreme left and right of the horizontal list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*6_rgjIl5I6svh8nj.png" /><figcaption>Extra spacing at the extreme end of horizontal lists</figcaption></figure><p>The design above indicates an extra spacing of 16px. Just enough to stand out from the typical spacing of 8px of the grid items. If you’re daring enough, you could even go for 24px!</p><p><strong>Indicate Vertical Scrolling too</strong></p><p>Assume your app supports both horizontal and vertical scrolling. We’ve already discussed leaving visual hints indicating horizontal scrolling.</p><p>How do you indicate vertical scroll? Websites indicate a vertical scrollbar on the side. But what about mobile?</p><p>Here’s a neat trick you can use, although not seen in many apps. Use a light, faded scrim at the bottom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*DTrauhATap7OM3gY.png" /><figcaption>Vertical scrim at the bottom that hints there’s more content</figcaption></figure><h3>Don’t confuse Tabs with Horizontal Lists</h3><p>Let me put this one bluntly. Assume your app has Tabs and one of them includes a horizontally scrolling list. Say, something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*lEKOLceDsh6FWl03aMH_qw.png" /><figcaption>Horizontal lists inside Tabbed navigation screens</figcaption></figure><p>How do you switch between Tabs? You swipe. Horizontally. How do you scroll the list? Horizontally.</p><p>That’s one gesture used for two different actions!</p><p>We need to differentiate between horizontal scrolling and Tab switching (swiping). We don’t want users to scroll to the end of a horizontal list, and then be taken to the next Tab.</p><p>So what can we do?</p><p>The easiest solution is to disable horizontal Tab swiping. The hardest way is to rethink your navigation. But keep in mind that easy doesn’t always mean better.</p><h4>Amazon Prime app</h4><p>Take a look at the Amazon Prime Video app for Android. They have horizontal scrolling lists with Tabs. But to avoid confusing swipes with horizontal scrolling, they disabled swiping between Tabs. So instead, you need to directly tap on a Tab to navigate. Smart!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*frL_e530aQqjTR_aQktBFA.png" /><figcaption>Amazon Prime Video — Android App. Image Credits: <a href="http://www.pcadvisor.co.uk/how-to/photo-video/how-watch-amazon-prime-on-android-3637285/">pcadvisor.co.uk</a></figcaption></figure><h4>TL;DR</h4><p>If you want to display different categories of a content, consider using horizontal lists. However, don’t include it in screens that belong to Tabbed navigation.</p><h3>Horizontal List Alternatives</h3><p>The very purpose of a horizontal list is to show similar content that belongs to a particular category.</p><p>Most apps that do this, display N (scrollable) items for a category. The remaining contents are hidden behind the SEE ALL button.</p><p>So either way, you’re not showing ALL contents of a category. Assuming you display 10, users will have to tap ‘See All’ to view the remaining 50 plus whatever contents.</p><p>If that’s what your horizontal list does, you don’t need a horizontal list at all.</p><h4>Use a Grid instead</h4><p>With no horizontal scrolling, users can now skim through your content faster. They just have to scroll in one direction. Vertically. We have already seen how Tablet designs adapt to this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/0*LdS0rwyN1FxEXoYy.png" /><figcaption>Horizontal list alternatives — using 2-row grids</figcaption></figure><p>The second example below is even better. The Google Play Music app shows four contents of a playlist, collaged together. You can access other music in the playlist by directly tapping the thumbnail itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*mnH1QiGCLwm4G4s69jq0IQ.png" /><figcaption>Google Play Music app</figcaption></figure><p>There are two advantages to this design decision:</p><ol><li>you retain the user’s natural flow of consuming content (vertical)</li><li>a user sees more initial content, than what a horizontal list shows</li></ol><p>Speaking of the second point, you may argue that a horizontal list shows more. Okay, I agree. But you need to scroll to see that don’t you?</p><p>The point of an alternative is for you to rethink. Do you really need those nested, horizontal scrolling lists? Users naturally scroll vertically. I say this multiple times because anything that breaks this flow, breaks the ability to skim quickly through content.</p><p>So before you decide upon horizontal lists, it’s worth weighing its negatives. Otherwise, before going with it, you can always try one of the methods above.</p><h3>Tip for Android Devs.</h3><p>Embedding a horizontally scrollable list in a vertical parent list is hard. In other words, nesting RecyclerView is easy to do, but difficult to get right.</p><p>But don’t sweat it. Nick Butcher has done this for Google’s I/O 2016 app and open-sourced it! It also includes some neat performance tweaks. You can <a href="https://github.com/google/iosched/blob/master/android/src/main/java/com/google/samples/apps/iosched/explore/ExploreIOFragment.java#L299">see it on GitHub</a>.</p><p><em>If you know a great resource for iOS, let me know! I’ll add it here.</em></p><h3>Conclusion</h3><p>Today, content-heavy apps use nested scrolling with horizontal lists. While that’s not wrong, it’s implementation must be done correctly. Horizontal scrolling feels more intuitive on mobile due to gestures.</p><p>But use it with caution, because it breaks our natural flow of consuming content. Which is reading vertically. Remember at the start of this article, we talked about Google’s Play Store app. We also saw why using a horizontal list is suitable for their scenario. So make sure you have good reason to include it in your app.</p><p>As UI/UX designers, it’s our responsibility to ensure that we don’t confuse users. After all, scrolling is the most highly-used gesture on mobile!</p><p><em>Suleiman is a UX Designer &amp; App developer who loves creating simple, usable &amp; beautiful experiences for people. He’s currently pursuing a Masters in UX Design at Rutgers, NJ. Check out his </em><a href="http://iamsuleiman.com/"><strong><em>portfolio</em></strong></a><em>.</em></p><p><em>First published at </em><a href="http://blog.iamsuleiman.com/horizontal-scrolling-lists-mobile-best-practices/"><em>blog.iamsuleiman.com</em></a><em> on May 9, 2017.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff%2F50d69a%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F50d69a%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/05d5fd32eda31cbd1b83287606744532/href">https://medium.com/media/05d5fd32eda31cbd1b83287606744532/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21480b9b73e5" width="1" height="1" alt=""><hr><p><a href="https://uxdesign.cc/best-practices-for-horizontal-lists-in-mobile-21480b9b73e5">Best Practices for Horizontal Lists in Mobile</a> was originally published in <a href="https://uxdesign.cc/">UX Collective</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Techniques to Display Text over Background Images]]></title>
            <link>https://uxdesign.cc/techniques-to-display-text-over-background-images-b089de1cc8bc?source=rss-83858f711e05------2</link>
            <guid isPermaLink="false">https://medium.com/p/b089de1cc8bc</guid>
            <category><![CDATA[ux-design]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[web-design]]></category>
            <dc:creator><![CDATA[Suleiman Shakir]]></dc:creator>
            <pubDate>Tue, 11 Apr 2017 03:30:21 GMT</pubDate>
            <atom:updated>2018-03-15T14:35:28.699Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*DgTW-QQ1gx26r0HXciv-CQ.png" /></figure><p>It’s become popular to overlay text labels on background images. But the image could be anything. How does your user interface design accommodate that? Can text overlay remain readable always?</p><p>The last thing you’d want is your users straining to read such text. This is all the more important on mobile. Smaller screens and smaller text make it harder to read.</p><p>But don’t worry. There are design techniques that can help make your text readable.</p><p>First, let me show you some design mockups that use text overlay.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Ip9rDJhwwCkZaUJl.jpg" /><figcaption><a href="https://dribbble.com/shots/3355951-Photography-Portfolio">Photography Portfolio by Winart Foster on Dribbble</a></figcaption></figure><p>Here’s another.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*CTAWVlpFkeCdVlt5.jpg" /><figcaption><a href="https://dribbble.com/shots/3139631-Article-Cards-Alternate">Article Cards Alternate by Oliur on Dribbble</a></figcaption></figure><p>A good eye will immediately notice the problem with these two designs. Take the second one with the sea waves. If the wave foam was on the lower half of the image, would that text be readable?</p><p>Let me try to recreate that design for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*PBYNvI_ZA8ZSoICCEB6yZQ.png" /><figcaption>Text with scrim overlay</figcaption></figure><p>How readable is the text now?</p><p>Alright, its not the same picture. But it’s still ocean waves.</p><p>The background image is outright disturbing. But the image is not to blame. After all, when you decide to overlay text, you must be ready for ANY image. Which means, the image could be anything.</p><blockquote><em>Good design is when we factor in all possible scenarios.</em></blockquote><p>Now don’t get me wrong. Those 2 designs are not bad in any way. In fact, I love the typography used in the second one. Both are well-designed interfaces by talented people. It’s just that, some interface designs (mockups) are only for aesthetic purposes.</p><p>Anyone who translates them into a working project will immediately recognise what’s wrong. The text displayed, does not account for its background images.</p><p>However these mockups are only examples. It assumes that whatever be the image, the text will be readable. But my design attempt just showed you that that’s not the case.</p><h3>The 2-in-1 problem with text overlay</h3><p>Now we could say that this pattern became overly popular thanks to Card design. I mean, most of the card designs include an image, with text overlaid on top. Not to say that its bad, but there are two things that are largely not considered.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcards.uplabs.com%2Fcards%2F28718%2Fpost%3Fv%3D1&amp;url=https%3A%2F%2Fmaterial.uplabs.com%2Fposts%2Ftrip-detail-card&amp;image=https%3A%2F%2Fassets.materialup.com%2Fuploads%2Fd0a10793-6021-4183-834d-0184e7d6e0e4%2Fpreview.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=uplabs" width="480" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/d03bdf415abb46aa47d539cc3fd9b0a6/href">https://medium.com/media/d03bdf415abb46aa47d539cc3fd9b0a6/href</a></iframe><p>When you overlay text on an image, you sacrifice two things:</p><ol><li>Image clarity</li><li>Text readability</li></ol><blockquote><em>Readability is the ease with which a reader can understand a written text. It is a measure of how easily a reader can distinguish individual letters or characters from each other. — Wikipedia</em></blockquote><p>Overlaying a text prevents viewing the image completely. Moreover, your text may not be readable.</p><p><strong>The image can be anything.</strong></p><p>Now, most of the examples above are mockups. Which means those are ideal scenarios. The text matches perfectly against its background. Things can immediately go wrong if your using white text over a whitish or light image. The same holds true for black or darker tones.</p><p>Now we know the mess we’re getting ourselves into. So let’s look at what we can do about it.</p><h3>Text Overlay Solutions</h3><p>There are different approaches to making our overlay text readable. I want you to understand that these are different solutions to a single problem. There is no single solution answer.</p><p>Moreover, deciding on what to use ultimately boils down to your personal preference. Or you can even decide upon one, depending on what fits your brand style.</p><h4>1. Using a Scrim</h4><blockquote><em>A Scrim is a semi-transparent gradient layer that helps Text appear more readable against backgrounds.</em></blockquote><p>A scrim is a solid to a transparent gradient that sits behind a Text Label. So for instance, your text label could be a constant white. Then, your scrim would be a gradient going from, say 40% black to transparent.</p><p>I leave the opacity percentage to you. Again that’s a matter of personal taste.</p><p>But a 40% black to transparent works really well. It’s not too evident and doesn’t disturb the image. It fades smoothly, giving the text label the contrast it needs, making it readable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N4XUEFACkSfPD3GWb_rnVw.png" /><figcaption>Scrim — gradient overlay</figcaption></figure><p><strong>Recommended Scrim guidelines:</strong></p><ul><li>30–70% opacity (40% is ideal)</li><li>100% to 0% opacity black</li><li>size: 50% of image height</li></ul><p>These are not hard rules. But as you can see from the above design, these settings work well.</p><p>Also, Material Design talks about text overlay on Imagery <a href="https://material.io/guidelines/style/imagery.html">in their guidelines</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/0*026na18e6kggJQP7.png" /><figcaption>Scrim gradient settings in Sketch</figcaption></figure><p><strong>Advantages:</strong></p><ul><li>Very simple and commonly used solution</li><li>Increases contrast for better text readability</li><li>A subtle design change that is hardly noticeable</li></ul><p><strong>Disadvantages:</strong></p><ul><li>Sharp gradients can break the image’s cohesiveness</li><li>Can block the image if visibility is too high</li></ul><p>By far, using a scrim is the most popular solution for solving the text overlay issue with images.</p><p>But wait, don’t go yet! There are other solutions which might suit your taste better.</p><h4>2. Overlay the entire image</h4><p>Like the scrim solution, but instead of a gradient, you’d apply a full 40% black to the whole image.</p><p>That’s right. Maybe the image isn’t important to you. The text label is your priority. Or maybe the text covers the entire image’s size.</p><p>In such a situation, using a scrim doesn’t make sense. Since the scrim is a gradient, your text becomes unreadable half-way across.</p><p>So since the text covers the whole image, the solution is to darken the entire image. In short, that’s a 40% opacity black on the image.</p><p><strong>Advantages:</strong></p><ul><li>Useful for large text (headings) that cover the entire image</li><li>Useful when text is your priority and not the image</li></ul><p><strong>Disadvantages:</strong></p><ul><li>Can obscure the entire image</li><li>Could sacrifice image visibility</li><li>Makes the image appear as if it’s for cosmetic appeal only</li></ul><p>Here is how Medium uses this technique.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*Qnu11SV7CABfCeo3.png" /><figcaption>Medium Series on Android</figcaption></figure><p>Notice that the images are a predominant part of the user interface. However, the text labels over them is what gives priority.</p><p>When I see want to click on a thumbnail, I do so by primarily seeing the text rather than the image. Hence the image here is only for visual appeal. So to allow text to stand out, the entire image is darkened.</p><p>Here’s another example.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcards.uplabs.com%2Fcards%2F52384%2Fpost%3Fv%3D1&amp;url=https%3A%2F%2Fmaterial.uplabs.com%2Fposts%2F85000-status-and-quotes-2017-android-app&amp;image=https%3A%2F%2Fassets.materialup.com%2Fuploads%2F0e4a8082-f1ff-42b7-88e0-c38db0660637%2Fpreview&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=uplabs" width="480" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/b49d30ecfff0e32f2116a962c820f7d1/href">https://medium.com/media/b49d30ecfff0e32f2116a962c820f7d1/href</a></iframe><h4>3. Color Overlay</h4><p>This is like an overlay. But instead of using black or white to darken or lighten the image, we use a different color.</p><p>Setting a <strong>color overlay</strong> on an image is the perfect way to neutralize a busy image. It blocks out all the different colors, making the image monotone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qXuYGNVDIIbcXqKSJXjoEw.png" /></figure><p>Usually, the color of choice is the brand color.</p><p>Here is an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*QE0uwVQZdIRkf73v.png" /><figcaption>Playgong App by Deividas Graužinis</figcaption></figure><h4>4. Soft gradients</h4><p>Remember that to use this correctly, your text should have enough contrast.</p><p>Also, when you use gradients, don’t use visually jarring colors. Chose colors that work together in harmony.</p><p>You can use web tools such as <a href="https://coolors.co/">Coolors</a> and <a href="https://color.adobe.com/create/color-wheel/">Kuler by Adobe</a>. These can help you generate color pairs that work well together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*q3zzSb3FDebrB7BXnr8H7Q.png" /></figure><p>Here’s an example.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcards.uplabs.com%2Fcards%2F51953%2Fpost%3Fv%3D1&amp;url=https%3A%2F%2Fmaterial.uplabs.com%2Fposts%2Fweb-agency&amp;image=https%3A%2F%2Fassets.materialup.com%2Fuploads%2F8fed1e5b-e769-4099-9950-36e016995c90%2Fpreview.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=uplabs" width="480" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/fbc88e3c85a8757ef597a28bff3c1e7a/href">https://medium.com/media/fbc88e3c85a8757ef597a28bff3c1e7a/href</a></iframe><p><strong>Advantages:</strong></p><ul><li>Better brand emphasis (if brand color used)</li><li>Single color tone allows room for better text contrast</li></ul><p><strong>Disadvantages:</strong></p><ul><li>Not suitable for pictures of people as it may not be recognizable</li></ul><p>Here’s a great collection of soft gradients you can use.</p><p><a href="https://dribbble.com/shots/3363903-Soft-Gradients-sketch-psd-xd">Soft Gradients (.sketch, .psd, .xd)</a></p><h4>5. Semi-Transparent Image</h4><p>This technique involves using a semi-transparent image against a solid color background. It helps ‘calm’ the noisy background, so the text can stand out.</p><p>The technique consists of 3 layers (from the bottom):</p><ol><li>Bottom — solid color</li><li>Middle — image (semi-transparent with 40% opacity)</li><li>Top — Text layer</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*Y17SBTgDHVRibE2-Snd77g.png" /></figure><p><strong>Advantages:</strong></p><ul><li>Reduces image noise allowing text to stand out</li><li>Makes the image monotone reducing color distraction</li></ul><p><strong>Disadvantages:</strong></p><ul><li>Image may lose its important details</li><li>Only suitable for images whose purpose is purely for eye-candy</li></ul><h4>6. Blur</h4><p>Applying a Gaussian blur softens an image allowing text to become more readable.</p><blockquote><em>Smoothing of images by reducing image noise and detail — Gaussian Blur</em></blockquote><p>iOS folks will be familiar with this technique. iOS design principles use blur to denote depth. Whereas Android (Material Design) uses shadows to denote depth (elevation).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bTah7XJGTR7SxsdxYuQBAg.png" /><figcaption><strong>16px</strong> blur on the left, and <strong>4px</strong> blur on the right</figcaption></figure><p><strong><em>NOTE:</em></strong><em> Consider using a Drop Shadow for increased text contrast.</em></p><p>Make sure you don’t blur the image too much that the underlying image is completely unrecognizable!</p><p><strong>Advantages:</strong></p><ul><li>Helps reduce the ‘busyness’ in images</li><li>Softened images give text more priority</li></ul><p><strong>Disadvantages:</strong></p><ul><li>Completely sacrifices the image for text</li><li>Still doesn’t solve same color overlay issue</li><li>May not suit your product style. For instance, using blur in a Material Design world?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*NLY3NPQ8S974ETH-.png" /><figcaption>Blur doesn’t solve same text and image color problem</figcaption></figure><h4>7. Text Highlight</h4><p>Here, we apply a background color to the text itself. This effect mimics the traditional way of highlighting text on paper.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zDKSdhD6r1ITTWJOwQJ4jg.png" /><figcaption>Text with Highlighter effect</figcaption></figure><p>This technique works well when the design has minimal text and a spacious background.</p><p>Remember that the highlight color doesn’t always have to be black. The example on the right borrows the dominant color from the image. This creates a higher sense of belonging with the image.</p><p>Android folks will recall that the <a href="http://blog.iamsuleiman.com/toolbar-animation-with-android-design-support-library/#dynamic-colors-with-palette-api">image’s dominant color can be extracted using the Palette API</a>.</p><p><strong>Advantages:</strong></p><ul><li>Good text clarity against any background image</li><li>Good contrast</li></ul><p><strong>Disadvantages:</strong></p><ul><li>Choice of highlight color may make text feel disconnected from image</li><li>Can completely block the underlying image</li></ul><h4>8. Go Grayscale</h4><p>Alright, this is more of altering the image than the text. But we can still use it to achieve what we want.</p><p>By using a grayscale image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*vNLzfXaM7LPT67oj.png" /><figcaption>Greyscale image filter</figcaption></figure><p>However, remember that greyscale includes colors from the brightest white to the darkest black. These alone, are on the polar ends of vibrancy. Hence you might want to consider toning down the image first. You can do so via a mix and match with any other techniques mentioned here.</p><p>For example, here’s a grayscale image with text at the bottom. However, by default this wouldn’t look good. So we add a scrim at the bottom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*9vfMCrCCixacWcxO.png" /><figcaption>Greyscale image with bottom Scrim combined</figcaption></figure><p>Notice how the scrim naturally blends very well with the image. The image is greyscale and our scrim is a black to transparent gradient. Hence the two techniques go hand-in-hand, quite well.</p><p>Also, in the previous image, I didn’t use a scrim. Instead I positioned the text on the top-left. This makes it readable as it sits over a less busy part of the image. That brings us to our next technique.</p><h4>9. Color and positioning</h4><p>Sometimes, no matter what, the image remains the same. Say, for example, a category page will use a constant header image depicting its category.</p><p>In such a situation, you know what image to expect. You can use this information to design your text. This can be the font, size, color or even positioning the text.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcards.uplabs.com%2Fcards%2F56542%2Fpost%3Fv%3D1&amp;url=https%3A%2F%2Fmaterial.uplabs.com%2Fposts%2Funiversitet-modules&amp;image=https%3A%2F%2Fassets.materialup.com%2Fuploads%2F0f60e770-3e25-4615-aeb8-f8d744840a26%2Fpreview.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=uplabs" width="480" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9d1cf0dc8c17f3d227417d576e583cc/href">https://medium.com/media/f9d1cf0dc8c17f3d227417d576e583cc/href</a></iframe><p>Notice the smart positioning of text, away from images. Also, the calm pastel background colors are not distracting. Both work in favor of the text. It remains clear and stands out, despite the background graphic.</p><h4>TL;DR — Use enough contrast</h4><blockquote><em>The state of being strikingly different from something else in close association. — Contrast</em></blockquote><p>Did you notice? All the techniques discussed above are ways to increase text contrast. Contrast is what makes an element appear distinct from one another. There should be high contrast between text and image. It allows text to be readable.</p><p>There is also no need to sacrifice image visibility for text. Both can coexist together if we use the right technique. For instance, using a scrim allows text to be readable. At the same time, the image is visible as well.</p><p>As a general rule, using greyscale colors work well. Which means, white text against a dark background. Or black (dark grey) text against a light background always works best.</p><h3>Conclusion</h3><p>We looked at techniques that make text readable, without sacrificing the background image. Techniques such as the scrim are perfect examples of this. Or, using a color overlay can help reinforce your brand by using its primary color. This is especially useful when the image feels out of place in your design. Moreover, the blur technique is useful as well. But you will have to see if it aligns with your design style.</p><blockquote>Remember that good design is thoughtful and knows how to balance aesthetic visuals with usability and clarity.</blockquote><p>It is not enough to let people use your app. It must be easy and pleasing to use.</p><p>You can even mix and match two techniques. Your imagination is the limit. Color overlay with scrim anyone?</p><p>So what do you think about these techniques? Have I missed out anything? Or do you have something to add to this article? Tell me in the comments below.</p><p><em>Suleiman is a UX UI Designer and App Developer who loves creating simple, usable and intuitive experiences for people. He’s currently pursuing his Masters in UX Design at Rutgers, NJ. Check out his </em><a href="http://iamsuleiman.com/"><strong><em>portfolio</em></strong></a><em>.</em></p><p><em>Originally published at </em><a href="http://blog.iamsuleiman.com/techniques-to-display-text-overlay-background-images/"><em>blog.iamsuleiman.com</em></a><em> on April 11, 2017.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff%2F50d69a%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F50d69a%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/05d5fd32eda31cbd1b83287606744532/href">https://medium.com/media/05d5fd32eda31cbd1b83287606744532/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b089de1cc8bc" width="1" height="1" alt=""><hr><p><a href="https://uxdesign.cc/techniques-to-display-text-over-background-images-b089de1cc8bc">Techniques to Display Text over Background Images</a> was originally published in <a href="https://uxdesign.cc/">UX Collective</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Using A Loading Spinner, There’s Something Better]]></title>
            <link>https://uxdesign.cc/stop-using-a-loading-spinner-theres-something-better-d186194f771e?source=rss-83858f711e05------2</link>
            <guid isPermaLink="false">https://medium.com/p/d186194f771e</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[user-experience]]></category>
            <category><![CDATA[user-experience-design]]></category>
            <category><![CDATA[design-thinking]]></category>
            <category><![CDATA[ux]]></category>
            <dc:creator><![CDATA[Suleiman Shakir]]></dc:creator>
            <pubDate>Tue, 28 Feb 2017 03:45:03 GMT</pubDate>
            <atom:updated>2018-10-05T20:53:46.707Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*ydZ4UjEWlWQC46V_MYq9iw.png" /></figure><p>Stop using those boring loading spinners in your user interfaces. Seriously. It’s killing your apps’ experience more than you know.</p><p>A loading spinner might be the solution to your content loading problems. But I’m here to tell you that it’s not.</p><p>You might even use some of those fancy animated loading Spinners. But they’re not any better either.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*mMTHT8fwuCvSSp0RNXM4nA.gif" /><figcaption><a href="https://dribbble.com/shots/2371491-Folding-cube-spinner-CSS"><em>By Tobias Ahlin on Dribbble</em></a></figcaption></figure><h3>Why the Loading Spinner doesn’t work</h3><p>From a long time we’re following, or rather influenced by hard rules from design languages. I don’t blame you though.</p><blockquote><em>The key to wisdom is this — constant and frequent questioning, for by doubting we are led to question and by questioning we arrive at the truth. — Peter Abelard</em></blockquote><p>A Loading Spinner is one of the most used progress indicators in user interface design. But it has its own flaws which are generally overlooked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*u_MFOXbdyf6ZJC4TRG3Csw.png" /><figcaption>Facebook using Loading Spinners for images and Pagination</figcaption></figure><p>Whenever I see that many Loading Spinners, I get a mini anxiety attack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*MioUn-FKLRwrBPm7CMjFtg.jpeg" /></figure><h3>1. No sign of progress</h3><p>What does the loading spinner tell you? It denotes that content is currently loading. But does it say how much has loaded? Does it say how much remains to load?</p><p>No. It doesn’t</p><p>Moreover, it’s difficult to determine. If it could, we’d be using a Progress Bar right?</p><h3>2. That period of uncertainty</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*beQRWt1uWdnQM_nqCwhJnA.gif" /><figcaption><a href="https://dribbble.com/shots/1201310-Animated-Loading-Spinner"><em>By Chanpory Rith on Dribbble</em></a></figcaption></figure><p>How long did you spend looking at that? Were you expecting some content to load after some time? I’m sorry to disappoint.</p><p>Ok, let’s assume that GIF loading actually completed and some content displays. Ask yourselves these questions and give me an honest response. I’m sure you’ve stared at enough Loading Spinners to know.</p><p>When you looked at the Loading Spinner, did you know:</p><ul><li>how much time remains to complete?</li><li>how much of the content has loaded?</li><li>how much remains to load?</li></ul><p>We simply sit staring at a Loading Spinner. Hoping that it loads in time, with no answer to either of those 3 questions.</p><p>Moreover, network connections might be unstable. So we can never take for granted that content will always load fast.</p><h3>3. Perceived to be slower than actual</h3><p>Loading Spinners make loading appear slower. Period.</p><p>It’s like a clock, constantly ticking. It shows the time you’re wasting by staring at it. Like that GIF above, which I made you stare at.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/0*KLZrzdGXZkD7cr-3.gif" /></figure><h3>4. What comes next is a surprise</h3><p>Until everything has loaded, do you have any idea what to expect on screen? I bet you don’t. You might even get surprised once the UI and content display.</p><p>Now think about your users. Until everything has loaded, they have completely no idea what to expect on screen. I bet they’ll get surprised too.</p><p>This won’t be their fault. You didn’t tell them what to expect in the first place!</p><h4><strong>A ‘Surprise’ isn’t always a good thing.</strong></h4><blockquote><em>An unexpected or astonishing event, fact, etc. — Surprise</em></blockquote><p>From the very definition of the word, a surprise indicates an ’<em>unexpected</em>’ event. People tend to have polarising reactions to such events. This could either positive or negative.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*oUUaoJTEWLH6SND5.jpg" /></figure><p>Surprises don’t often tend to leave a positive impact on people. Unless it’s their birthday. It depends upon how a person takes it. Thus, herein lies the problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*AQ6etQJ05dR_skit7doAiA.png" /></figure><p>Take a good look at both the images. See the image on the right. Could you honestly predict the UI would finally look like that? I’m sure not.</p><p>Alright, the final UI is a low fidelity design. But you get the point.</p><p>I deliberately did not pull examples from existing apps. Because you and I both know what it will look like. With a known app, we’ve already seen the interface, even before its loaded.</p><h3>5. Emotions affect our sense of time</h3><p>Did you know? We humans can actually predict time. That too quite accurately!</p><p>But under an emotional influence, our sense of time is significantly clouded.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxT5LMHB9KDyfLE2eTC%2Ftwitter%2Fiframe&amp;src_secure=1&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxT5LMHB9KDyfLE2eTC%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxT5LMHB9KDyfLE2eTC%2Fgiphy.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=giphy" width="480" height="270" frameborder="0" scrolling="no"><a href="https://medium.com/media/ccdb0955288fe9cf2ac47641d8a1cfa8/href">https://medium.com/media/ccdb0955288fe9cf2ac47641d8a1cfa8/href</a></iframe><p>We’ve all experienced this. Time seems to fly when you’re doing what you love. But if it’s something you hate, time seems to drag. Even when you’re bored, staring at the clock waiting for your favourite show. Time moves even slower then.</p><p>This same holds true for our interfaces.</p><p>The point I’m trying to make is, your content might not take much time to load. In fact, it might not be a big deal. But it may appear longer than it actually takes. It is just how people might perceive it.</p><p>What we can do, is help change their perception. We can make our app ‘appear’ faster than it actually is.</p><p><strong><em>NOTE: </em></strong><em><br>Don’t get too carried away trying to fake it. Your interface needs a combination of real and perceived speed to succeed.</em></p><h3>The Illusion of Alternatives</h3><p>Typically, we have two options to denote loading content:</p><ol><li><strong>Finite progress bar </strong>— if we can determine load times</li><li><strong>Loading Spinner</strong> (infinite loading progress) — if load times are unknown</li></ol><p>But take a closer look at the choices again. Do you realise, there is no real choice here?</p><p>We can’t use a finite progress bar because we cannot measure load times. Also, we already know that the Loading Spinner is no good.</p><h4>A good progress indicator</h4><p>A good progress indicator is one which obviously doesn’t have any of the negatives I mentioned above. But for a more optimistic tone, let me list them out.</p><ol><li>Gives immediate feedback</li><li>Provides a sense of time ( how much has progressed, and how much is pending)</li><li>Removes doubt (gradual progress reassures people that the app is working)</li></ol><h3><strong>Some proof as backup</strong></h3><p>Some of you might not believe what I said. Even I wouldn’t. After all, where is the proof? Do loading indicators really harm? Who has experienced it?</p><p>Well, then consider yourself lucky. You get to learn from someone else’s mistakes.</p><p>The <a href="http://www.lukew.com/ff/entry.asp?1797">iOS app Polar strongly suggests avoiding the Spinner</a>.</p><p>Polar received a lot of complaints about their app being slow. This was because of the loading spinners they included in their app.</p><blockquote><em>With progress indicators, we had made people watch the clock. As a result, time went slower and so did our app. We focused on the indicator and not the progress, that is making it clear you are advancing toward your goal not just waiting around. — </em>Polar</blockquote><p>I guess I’ve rambled enough about why Loading Spinners are bad. The problem with a Spinner lies in not providing a sense of progress. Though, we can remedy this.</p><p>How, you ask? The answer is ‘<strong><em>Skeleton Screens</em></strong>‘.</p><h3>Skeleton Screens to the rescue</h3><p>Unlike Loading Spinners, where the UI displays all at once. A skeleton screen helps load a user interface gradually, a little at a time.</p><p>This means that the barebones UI displays first. Then the loaded content is gradually populated on-screen.</p><blockquote><em>“A skeleton screen is essentially a blank version of a page into which information is gradually loaded.” — Luke Wroblewski</em></blockquote><p>LinkedIn recently started using Skeleton Screens for loading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4IuMC5uqEaytpPvrgGzOmg.png" /></figure><p>Skeleton screens shift the attention of users. It makes people focus on the progress, rather than the wait time.</p><p>Skeleton screens visually tells users what to expect from the interface. It gives them a heads up on what’s going to come and creates a sense of gradual progress.</p><p>Most of all, it makes people perceive your site to be faster than it actually is. Remember that we are designing interfaces for use by real people. We need to give people the illusion of speed.</p><blockquote><em>The more the system gives information about the waiting time, the better the satisfaction of the user. — </em><a href="http://www.guillaumegronier.com/cv/resources/Articles/2013_WorkshopHCI_Gronier.pdf"><em>How to Improve Perceived Waiting Time in HCI</em></a></blockquote><p>Using a skeleton screen gives you the following benefits:</p><ul><li>Helps people perceive your screen to load faster</li><li>Eliminates surprises</li><li>Gradual loading of UI — clear indication of progress</li><li>Shows exactly what’s loaded and what’s yet to load</li></ul><h3>Gradual progression</h3><p>I know it’s a fancy term. But what it means is, loading your content gradually. Folks from web design and development know this as ‘<em>Lazy-loading</em>’.</p><blockquote><em>Defer initialization of an object until the point at which it is needed. — </em><a href="https://en.wikipedia.org/wiki/Lazy_loading"><em>Lazy Loading</em></a></blockquote><p>First, lay out the bare bones UI (Skeleton screen). Next, load the text data. By now, the user knows they’ve received the content. Finally, lazy load the images. The user now understands that most of the content has loaded and what’s left are the images.</p><p>In this way, you’ve given users:</p><ul><li>A clear sense of progress</li><li>What to expect next</li><li>What’s left to expect</li></ul><p>Notice how Instagram intelligently handles loading here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aqKnBhSKXNnBA1aLKPNy5g.png" /><figcaption>Instagram loading — gradual progression</figcaption></figure><p>First, Instagram shows a loading spinner for a brief period. Next, it lays out the barebones UI. This is the skeleton screen or Placeholder UI. This indicates the place where content will eventually fill.</p><p>Also, notice that the text data has already populated the screen. Finally, in the third screenshot, the images are gradually loaded into place.</p><p>Here are some websites that use skeleton screens to show loading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jUjQZlSm3C3TMup6z9yyDw.png" /><figcaption>Skeleton Loading used in Facebook</figcaption></figure><p>Look at how Medium handles loading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ds7zZElR9T-8rAdlOPlD7A.png" /><figcaption>Loading seen on <a href="https://medium.com/">Medium.com</a></figcaption></figure><p>You might argue that these websites use Loading Spinners too. But notice how it is used.</p><p><strong>A Spinner alone is not displayed from start to finish! </strong>It is shown only for a brief period, followed by the Skeleton Screen.</p><p><strong><em>TIP:</em></strong><em> <br>If your load time is longer, you can briefly display a Loading Spinner, before Skeleton UI. This should buy your task some more time to complete.</em></p><h3>Progressive Loading for Images</h3><p>You can even apply gradual progression to image loading. For example, Medium and Google use progressive loading for their images.</p><p>Google displays the image’s prominent color first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*STsY5lfD4DA2wigfN76QpQ.png" /><figcaption>Progressive Loading in Google Image Search</figcaption></figure><p>Medium handles it a little differently. The website uses an extremely small, pixelated image and blurs it. Later, it loads a higher quality image to replace it, coupled with a nice fade-in animation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JIph8aM2PyQb-o_RJhnmnQ.png" /><figcaption>Progressive Image Loading in Medium</figcaption></figure><p>I’m sure you’ve seen either one of these. Maybe you didn’t know it had a proper name until now.</p><p>Here are the generic steps on progressive loading for images.</p><ol><li>Display the skeleton screen</li><li>Load a very low quality (pixelated) version of the image (or prominent color)</li><li>Load the high-quality image in background</li><li>Fade in the high-quality image, replacing the previous low-quality one</li></ol><p>Note that you’ve not given then a clear indication of WHEN the task will complete. There is still no solid time estimate. But you have told that what has completed and what remains. That itself is clear sign of progress.</p><h3>Skeleton Screens on Android and iOS</h3><p>You might argue saying most of the skeleton screen examples are websites. So how do I do this on mobile? You’re absolutely right. Reading all this wouldn’t be worth it if I didn’t even give you a hint on how to do this.</p><h4><strong>Shimmer by Facebook</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/0*MYLZrHzlc2fKGT24.gif" /></figure><p>Facebook has written a library called Shimmer for both <a href="https://github.com/facebook/shimmer-android">Android</a> and <a href="https://github.com/facebook/Shimmer">iOS</a>.</p><p>It works just like how Facebook uses skeleton UI to load incoming content. The shimmer animation depicts that content is currently loading.</p><p>You can use this library to display skeleton screens that denote loading in your apps.</p><h3><strong>Handling Failure with Skeleton Screens</strong></h3><p>There’s no guarantee that a request will always execute successfully. So we cannot assume that if a content loads gradually, it will eventually complete. Chances are, it might fail mid-way. The most common reasons include faulty, slow or no connectivity.</p><p>Assume you’ve started a request to load content. Next, the skeleton screen is also displayed. Then suddenly, your internet goes off. How would you handle this?</p><p>Typically, you must inform the user and allow them to retry.</p><blockquote>Remember that giving feedback is good interaction design and positive user experience.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcards.uplabs.com%2Fcards%2F38519%2Fpost%3Fv%3D1&amp;url=https%3A%2F%2Fios.uplabs.com%2Fposts%2Fno-internet-connection-interface&amp;image=https%3A%2F%2Fassets.materialup.com%2Fuploads%2F360d0b36-7b3a-421e-9dc5-1c8390d16d73%2Fpreview.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=uplabs" width="480" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4c57333c40b28497b84dffa923b6bf8/href">https://medium.com/media/d4c57333c40b28497b84dffa923b6bf8/href</a></iframe><p><strong>TIP:</strong> <br><em>Consider using ‘ </em><a href="https://material.io/guidelines/patterns/empty-states.html"><strong><em>Empty States</em></strong></a><em> ’. It allows you to provide clear feedback with a ‘Call to Action’ (CTA) button.</em></p><p>Empty states occur when an item’s content can’t be shown.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcards.uplabs.com%2Fcards%2F46534%2Fpost%3Fv%3D1&amp;url=https%3A%2F%2Fmaterial.uplabs.com%2Fposts%2Freminders-empty-state&amp;image=https%3A%2F%2Fassets.materialup.com%2Fuploads%2F6d5070a4-9516-4e6d-a958-1c0d815c8fdf%2Fpreview.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=uplabs" width="480" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/e56b8b65ae84fa589427f3ceb605960e/href">https://medium.com/media/e56b8b65ae84fa589427f3ceb605960e/href</a></iframe><h4>Connectivity in Android and iOS</h4><p>Here are a couple of resources that can help you handle connectivity.</p><p><strong>Android</strong></p><ul><li><a href="http://blog.iamsuleiman.com/material-design-snackbar/">Use a Snackbar</a> to provide feedback with CTA button</li><li><a href="https://gist.github.com/emil2k/5130324">Connectivity</a> — network handling utility class</li></ul><p><strong>iOS — Swift</strong></p><ul><li><a href="https://github.com/vsouza/awesome-ios#alerts">iOS Alerts</a> — collection of alert libraries to chose from</li><li><a href="https://github.com/ashleymills/Reachability.swift">Reachability</a> — network handling</li></ul><h3>Wrapping Up</h3><p>Apps are getting smart. People are starting to realise that the Loading Spinner is hurting their UX. Hence, it’s about time you did too.</p><p>Skeleton screens provide incremental progress in loading your interface. Such incremental feedback gives better user experience and reduces uncertainty. Moreover, people would be willing to wait a bit longer.</p><p>So what do you think about Skeleton screens? Is it a viable alternative to a Loading Spinner? Let me know in the comments.</p><p><em>Suleiman is a UX UI Designer &amp; App developer who loves creating simple, usable, yet beautiful experiences for people. He’s currently pursuing his Masters in UX Design at Rutgers, NJ. Check out his </em><a href="http://iamsuleiman.com/"><strong><em>portfolio</em></strong></a><em>.</em></p><p><em>Originally published at </em><a href="http://blog.iamsuleiman.com/stop-using-loading-spinner-theres-something-better/"><em>blog.iamsuleiman.com</em></a><em> on February 28, 2017.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff%2F50d69a%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F50d69a%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/05d5fd32eda31cbd1b83287606744532/href">https://medium.com/media/05d5fd32eda31cbd1b83287606744532/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d186194f771e" width="1" height="1" alt=""><hr><p><a href="https://uxdesign.cc/stop-using-a-loading-spinner-theres-something-better-d186194f771e">Stop Using A Loading Spinner, There’s Something Better</a> was originally published in <a href="https://uxdesign.cc/">UX Collective</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ultimate Guide to Bottom Navigation on Android]]></title>
            <link>https://medium.com/android-news/ultimate-guide-to-bottom-navigation-on-android-75e4efb8105f?source=rss-83858f711e05------2</link>
            <guid isPermaLink="false">https://medium.com/p/75e4efb8105f</guid>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Suleiman Shakir]]></dc:creator>
            <pubDate>Tue, 22 Mar 2016 04:17:45 GMT</pubDate>
            <atom:updated>2017-10-24T17:27:42.633Z</atom:updated>
            <content:encoded><![CDATA[<h4>In this tutorial, learn to add a Bottom Bar and manage Fragments with it.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*cEeQOtYfJ3sHR5AuggKVjg.png" /></figure><p>One of the newest additions to the Material Design is the Bottom Navigation Bar. Its like the TabBar you see on iOS, and similar in functionality too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*92xo3yirVHNgXSUDbPxRSA.jpeg" /><figcaption>Facebook iOS app TabBar</figcaption></figure><p>Before getting to the tutorial, let’s get to know what Bottom Navigation is. Also let’s narrow down on the best scenarios to use it.</p><h3>What is Bottom Navigation?</h3><blockquote><em>Bottom navigation bars make it easy to explore and switch between top-level views in a single tap. — </em><a href="https://www.google.com/design/spec/components/bottom-navigation.html#bottom-navigation-usage"><em>Material Design spec</em></a></blockquote><p>This helps developers opt for Bottom Navigation, instead of a Navigation Drawer.</p><p>If you have about four top-level navigation items, its ideal to use Bottom Navigation. Otherwise, go for a Navigation Drawer. We don’t want the Bottom Navigation looking too crowded now, do we?</p><p>This was already common for iOS apps. But now, a lot of Android apps have started adapting this. To name a few, the YouTube app recently made the switch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/1*q6nL0MADDkY-a8M4WvAaRQ.png" /><figcaption>YouTube app’s simplified navigation with Bottom Bar</figcaption></figure><h4>When to use?</h4><blockquote><em>A Bottom Navigation is best used when you have three to five top-level navigation items of similar importance.</em></blockquote><p>Until now, the default, go-to navigation solution is the <a href="http://blog.iamsuleiman.com/easy-navigation-drawer-with-design-support-library/">Navigation Drawer</a>. Would you agree?</p><p>Grab all your screens, throw them in the Navigation Drawer and we’re done. I don’t blame you. Once upon a time, I was guilty of the same.</p><p>For just 4 navigation screens, would you use an entire Navigation Drawer for it? Besides, that huge side menu is hidden away by a tiny hamburger menu.</p><p>Think of the benefits a Bottom Navigation provides:</p><ul><li><strong>always visible</strong> — its omnipresent no matter which of the 4 screens you visit</li><li><strong>simpler</strong> — lesser the options, easier to remember</li></ul><p>So given all that, in such a scenario, a Bottom Navigation will serve you the best.</p><h4><strong>A simpler way to look at it…</strong></h4><p>If all that seems too complex, then just keep the number of navigation screens in mind.</p><ul><li><em>2 screens</em> — <a href="http://blog.iamsuleiman.com/material-design-tabs-with-android-design-support-library/">Tabs</a></li><li><em>3 to 5 screens</em> — Bottom Navigation</li><li><em>5 and above</em> — Navigation Drawer</li></ul><p>Easy enough? Now let’s move on.</p><h3>Getting Started</h3><p>I must admit the Bottom Navigation looks pretty cool. I noticed Aurelien Hubert has a fancy Bottom Navigation library. So let’s use that for this tutorial.</p><p><a href="https://github.com/aurelhubert/ahbottomnavigation">aurelhubert/ahbottomnavigation</a></p><p><strong>NOTE:</strong><br>Android Design Support Library provides a Bottom Navigation Bar too. But compared to this one, what we can do with it is currently limited. Hence, to know what all is possible with the Bottom Bar, we’ll go with Hubert’s library.</p><p>However, if you want the native solution instead, this tutorial’s got you covered.</p><p><a href="http://blog.iamsuleiman.com/using-bottom-navigation-view-android-design-support-library/">Using Bottom Navigation View with Android Design Support Library- Grafix Artist</a></p><p>But seriously, read this first. This one’s got all the bells and whistles.</p><p>First, start by adding the library’s dependency to your <strong>build.gradle</strong> file.</p><pre>dependencies {<br>    //...    <br>    compile &#39;com.aurelhubert:ahbottomnavigation:2.0.4&#39;<br>}</pre><p><strong>NOTE:</strong><br>I hope your app supports <strong>minSdk &gt;14</strong>. If not, make sure you do, because this library supports 14 and above only. Seriously, why are you supporting 0.99% of the (ancient) devices!?</p><h4>Adding Bottom Navigation to Layout</h4><p>Make sure your parent layout is a CoordinatorLayout. This ensures the Bottom Navigation behaves correctly with <a href="http://blog.iamsuleiman.com/material-design-snackbar/">Snackbar</a> and FAB.</p><pre>&lt;android.support.design.widget.CoordinatorLayout<br>    android:id=&quot;@+id/coordinator&quot;<br>    android:layout_width=&quot;match_parent&quot;<br>    android:layout_height=&quot;match_parent&quot;&gt;</pre><pre>&lt;android.support.design.widget.AppBarLayout<br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;wrap_content&quot;&gt;</pre><pre>&lt;android.support.v7.widget.Toolbar<br>            android:id=&quot;@+id/toolbar&quot;<br>            android:layout_width=&quot;match_parent&quot;<br>            android:layout_height=&quot;?attr/actionBarSize&quot;<br>            android:background=&quot;?attr/colorPrimary&quot;/&gt;</pre><pre>&lt;/android.support.design.widget.AppBarLayout&gt;</pre><pre>&lt;FrameLayout<br>        <strong>android:id=&quot;@+id/frame&quot;</strong><br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;match_parent&quot;<br>          <strong>app:layout_behavior=&quot;</strong><a href="http://twitter.com/string/appbar_scrolling_view_beh"><strong>@string/appbar_scrolling_view_beh</strong></a><strong>avior&quot;</strong>/&gt;</pre><pre>&lt;com.aurelhubert.ahbottomnavigation.AHBottomNavigation<br>        android:id=&quot;@+id/bottom_navigation&quot;<br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;wrap_content&quot;<br>        <strong>android:layout_gravity=&quot;bottom&quot;</strong>/&gt;</pre><pre>&lt;/android.support.design.widget.CoordinatorLayout&gt;</pre><p>The FrameLayout with ID <em>@+id/</em><strong><em>frame</em></strong> is the placeholder UI to load our Fragment.</p><h3>Moving onto Java</h3><p>Each Bottom Navigation bar item denotes a different color. For demonstration purposes, each item click will change the Fragment’s view color. But ideally, you’ll want to load a different Fragment for each item. I’ll tell you how to switch Fragments, a bit further into the article.</p><p>Initializing and using the Bottom Navigation is easy as one two three. I ain’t even kidding. See for yourself!</p><h4>1. Create your Items</h4><p>There are different constructors you can use to define your Bottom Navigation items.</p><p>At the least, you must provide a title and icon. In other words, a String and Drawable.</p><p>Both parameters can be hardcoded Strings. But for the sake of good practice, lets reference both from XML resources.</p><pre>AHBottomNavigationItem item1 = <br>    new AHBottomNavigationItem(R.string.bottomnav_title_0,     <br>                               R.drawable.ic_map_24dp);</pre><h4>2. Add Bottom Navigation items</h4><p>Once you’ve defined the number of items, its time to add them to the Bottom Navigation.</p><pre>bottomNavigation.addItem(item1);</pre><h4>3. Set Listener</h4><p>Finally, you need to listen to item clicks. So add the following to your Fragment.</p><pre>bottomNavigation.setOnTabSelectedListener(new AHBottomNavigation.OnTabSelectedListener() {<br>          <a href="http://twitter.com/Override">@Override</a><br>          public void onTabSelected(int position, boolean wasSelected) {<br>               fragment.updateColor(Color.parseColor(colors[position]));<br>          }<br>      });</pre><p>I have a tiny card layout centered in my Fragment layout. Depending on the item click, I change its color.</p><p>Also, don’t forget to set your default item. This item depicts the default (home) screen which people will see.</p><pre>// Setting the very 1st item as home screen. bottomNavigation.setCurrentItem(0);</pre><p>Ideally, you’d want to change the Fragment here. The same way when <a href="http://blog.iamsuleiman.com/easy-navigation-drawer-with-design-support-library/">creating a Navigation Drawer in Android</a>. More on this later.</p><h3>Styling Bottom Navigation</h3><p>Off the bat, the library provides considerable styling options. But after recent updates, there has been a lot more.</p><p>Some of these additions include notification badges and coordinating behaviors. It also includes <a href="http://blog.iamsuleiman.com/quick-return-pattern-with-android-design-support-library/">on-scroll Quick Return pattern</a>.</p><p>Its all that one could ever want with the Bottom Navigation. This library is much more feature-rich than <a href="http://blog.iamsuleiman.com/using-bottom-navigation-view-android-design-support-library/">what Android Design Support Library offers</a>. So if you want more customization options and more control, you know what to use.</p><p>Before we get to that, here’s a heads-up. We’ll be using and referencing a lot of colors. Normally, we reference colors in Android like this:</p><pre>ContextCompat.getColor(context, R.id.yourcolor);</pre><p>Now I’m no fan of writing such a lengthy line for fetching a simple color resource.</p><p>So I’ll write a simple method that shortens what I have to type.</p><pre>private int fetchColor(<a href="http://twitter.com/ColorRes">@ColorRes</a> int color) {<br>        return ContextCompat.getColor(this, color);<br>}</pre><p>Great! From now on I don’t have to write long lines. This simple method call will do to fetch my color resource.</p><p><strong>TIP:</strong><br>Hiding the complexities of a system by providing a simpler interface is known as the <a href="https://www.tutorialspoint.com/design_pattern/facade_pattern.htm"><strong>Facade</strong> Design Pattern</a>.</p><p>With that out of the way, let’s look at implementing all the possible styling options.</p><h4>Simple Theming</h4><p>At the most basic level, the Bottom Navigation requires these attributes:</p><ol><li><em>Default background color</em></li><li><em>Accent color</em> — highlights active items</li><li><em>Inactive color</em> — (you guessed it!) color for inactive items</li></ol><pre>bottomNavigation.setDefaultBackgroundColor(Color.WHITE);<br>bottomNavigation.setAccentColor(fetchColor(R.color.yourAccentColor));<br>bottomNavigation.setInactiveColor(fetchColor(R.color.yourInactiveColor));</pre><p>With such basic styling, you can expect your Bottom Navigation to look like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*1jyIpDeqS5RFCmW-_W4Uhw.png" /><figcaption>Bottom Navigation with basic styling</figcaption></figure><h4>Color Ripple Effects</h4><p>You can take styling a step further by using a color ripple.</p><p>Yes, I’m talking about this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/0*9UOktkAwfi8APc76.gif" /><figcaption>Bottom Navigation with Color Ripple</figcaption></figure><p>The good news is that its easy to enable a colored ripple.</p><pre>//  Enables color Reveal effect<br>bottomNavigation.setColored(true);<br>// Colors for selected (active) and non-selected items (in color reveal mode).<br>bottomNavigation.setColoredModeColors(Color.WHITE,<br>                fetchColor(R.color.bottomtab_item_resting));</pre><p>The method setColoredModeColors() defines the colors for items when using color ripple.</p><h3>Text Labels</h3><p>Here’s what the <a href="https://material.io/guidelines/components/bottom-navigation.html#bottom-navigation-usage">Material Design documentation</a> tells us. If Bottom Navigation has:</p><ul><li><em>3 items</em> — display icon and text always for all items</li><li><em>4–5 items</em> — display text for active icon only and hide for inactive views</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*ObULhMrS6EZlQDzF8WexCQ.png" /><figcaption>Bottom Navigation as seen in Material Design docs</figcaption></figure><p>Now, you might have a good guess on what I’m going to say next.</p><p><em>“This is what the Material Design guidelines suggest, so let’s do just that”.</em></p><p>But this time I won’t. I disagree, and so should you. I’ll tell you why.</p><h4>The Material Design guidelines aren’t always right</h4><p>Whether you have 3 or 5 items in your Bottom Navigation, ALWAYS show text labels!</p><p>By doing so, you’ll avoid the <a href="https://medium.freecodecamp.com/material-design-and-the-mystery-meat-navigation-problem-65425fb5b52e#.1ty8v8bst"><strong>Mystery Meat Navigation</strong> problem that plagues Material Design</a>. Shoutout to <a href="https://medium.com/u/989045733969">Teo Yu Siang</a> for making aware of this!</p><blockquote><em>Buttons or links that don’t explain to you what they do. Instead, you have to click on them to find out — Mystery Meat Navigation.</em></blockquote><p>I’m sure we’ve all been victims of this at some point at least. We click on a button assuming it to do something, only for it to do something else entirely!</p><p>So do yourselves, and your users a favor. Always, show text labels for your Bottom Navigation icons.</p><pre>bottomNavigation.setTitleState(AHBottomNavigation.TitleState.ALWAYS_SHOW);</pre><p>I did my part to give good UX. What about you?</p><h4>Translucent Bottom Navigation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*xQoQC86snooBa5Rv5QD0KA.png" /><figcaption>Translucent Bottom Navigation</figcaption></figure><p>First, you create an app Theme that supports translucent navigation.</p><pre>&lt;style name=&quot;MyTheme.TranslucentNavigation&quot; parent=&quot;MyTheme&quot;&gt;<br>       &lt;item name=&quot;android:windowTranslucentNavigation&quot;&gt;true&lt;/item&gt;<br>&lt;/style&gt;</pre><p>Next, in your <em>AndroidManifest.xml</em>, apply this Theme to your Bottom Navigation Activity.</p><pre>// ... <br>&lt;activity<br>            android:name=&quot;.YourActivity&quot;<br>        android:theme=&quot;<a href="http://twitter.com/style/MyTheme">@style/MyTheme</a>.TranslucentNavigation&quot;&gt;<br>//...</pre><p>Finally, the last step is to add one simple line to <strong><em>YourActivity.java</em></strong>.</p><pre>bottomNavigation.setTranslucentNavigationEnabled(<strong>true</strong>);</pre><h3>Behaviors</h3><p>The library allows on-scroll animation for the Bottom Navigation Bar. It also supports a Translucent Theme for the same. Let’s see how we can enable both.</p><h4>Quick Return Animation</h4><blockquote><em>A View can</em><strong><em> scroll off-screen</em></strong><em> with the content and return when the user reverse scrolls. — Quick Return</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*3qHIzB_ora_3vgiq.gif" /><figcaption>Hide on scroll — Quick Return</figcaption></figure><p>This is a popular Animation pattern that helps maximize screen estate while scrolling. Usually the <a href="http://blog.iamsuleiman.com/quick-return-pattern-with-android-design-support-library/">Quick Return animation pattern is used for Toolbars</a>.</p><p>The good new is, this library allows us to enable the same for Bottom Navigation. You just have to add this simple line.</p><pre>bottomNavigation.setBehaviorTranslationEnabled(<strong>true</strong>);</pre><h4>Translucent Navigation with Quick Return</h4><p>Now you might get ambitious and want to combine both. A translucent Bottom Navigation and <em>Quick Return pattern</em>.</p><p>While I applaud your bravery, there’s a small hiccup in making both work together.</p><p>You already might have set up a Translucent Navigation. But once you enable Quick Return, you might notice the scroll not behaving as expected.</p><p>The Toolbar might appear clipped. No amount of fitsSystemWindows will help.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*zXcSCfJ903LlN202_88QfA.png" /><figcaption>Toolbar clipping with Translucent bar + quick return</figcaption></figure><p>See the Toolbar? That’s the hiccup I’m talking about!</p><p>But don’t worry. I’ll tell you how to fix this.</p><p>Ideally, you’ll play around with fitsSystemWindows=true for your layout. But what worked for me is a very simple approach. Its not perfect, but it gets the job done.</p><p>All you have to do is alter your AppBarLayout. Add a View as a child to your AppBarLayout, above the Toolbar View.. This View should have a height equal to the <em>StatusBar</em>, which is <strong>24dp</strong>.</p><pre>&lt;android.support.design.widget.CoordinatorLayout &gt;<br>    &lt;android.support.design.widget.AppBarLayout&gt;</pre><pre>     &lt;LinearLayout<br>      android:orientation=&quot;vertical&quot;&gt;</pre><pre>        <strong> &lt;View<br>            android:layout_width=&quot;match_parent&quot;<br>            android:layout_height=&quot;</strong><a href="http://twitter.com/dimen/statusBarSize"><strong>@dimen/statusBarSize</strong></a><strong>&quot; /&gt;</strong></pre><pre>         &lt;android.support.v7.widget.Toolbar<br>             android:id=&quot;@+id/toolbar&quot;<br>            android:layout_width=&quot;match_parent&quot;<br>            android:layout_height=&quot;?attr/actionBarSize&quot;<br>            android:background=&quot;?attr/colorPrimary&quot;/&gt;<br>    &lt;/LinearLayout&gt;</pre><pre>&lt;/android.support.design.widget.AppBarLayout&gt;</pre><pre>&lt;!-- Your Fragment or ViewPager layout here... <br>     Don&#39;t attribute app:layout_behavior=&quot;@string/appbar_scrolling_view_behavior&quot; --&gt;</pre><pre>&lt;com.aurelhubert.ahbottomnavigation.AHBottomNavigation<br>        android:id=&quot;@+id/bottom_navigation&quot;<br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;wrap_content&quot;<br>        android:layout_gravity=&quot;bottom&quot;/&gt;</pre><pre>&lt;/android.support.design.widget.CoordinatorLayout&gt;</pre><p><em>If anyone knows how to get it working with </em><em>fitsSystemWindows, do let me know!</em></p><p><strong>TIP:</strong><br><strong>AppBarLayout is a vertical </strong><strong>LinearLayout</strong> that determines scrolling behavior of its child Views.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/223/0*PbJ10kZebnfFYGza.gif" /><figcaption>Translucent bar with quick return</figcaption></figure><h3>Notification Badge</h3><p>This again is simple. For the sake of demonstration, I’ll show you by creating a dummy notification.</p><h4>Show notification</h4><p>Let’s say I want to show a notification count of 1, for the last item. We can use the library’s <strong>AHNotification</strong> class for this.</p><pre>private void createFakeNotification() {<br>       new Handler().postDelayed(new Runnable() {<br>           <a href="http://twitter.com/Override">@Override</a><br>           public void run() {<br>               AHNotification notification = new AHNotification.Builder()<br>                       .setText(&quot;1&quot;)<br>                       .setBackgroundColor(Color.YELLOW)<br>                       .setTextColor(Color.BLACK)<br>                       .build();<br>               // Adding notification to last item.</pre><pre>bottomNavigation.setNotification(notification, bottomNavigation.getItemsCount() - 1);</pre><pre>notificationVisible = true;<br>           }<br>       }, 1000);<br>   }</pre><p>The Builder allows us to customize the text, its color and the background. Then, remember to set that notification to the Bottom Navigation item.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pkr6ChXXNcDubVPd3rkCwQ.png" /><figcaption>Notification Badge in Bottom Bar’s third item</figcaption></figure><h4>Removing the Notification Icon</h4><p>In the above code snippet, I used a boolean <strong><em>notificationVisible</em></strong>. It tells us whether the notification badge is currently visible or not.</p><p>A notification must be removed or dismissed once we tap the respective item. We can do this in 2 simple steps:</p><ol><li>detect the item click via OnTabSelectedListener</li><li>check if notification is visible and remove it</li></ol><pre>bottomNavigation.setOnTabSelectedListener(new AHBottomNavigation.OnTabSelectedListener() {<br>         <a href="http://twitter.com/Override">@Override</a><br>         public boolean onTabSelected(int position, boolean wasSelected) {<br>             <br>        //TODO: update Fragment here</pre><pre>// remove notification badge<br>       int lastItemPos = bottomNavigation.getItemsCount() - 1;<br>             if (notificationVisible &amp;&amp; position == lastItemPos)<br>                 bottomNavigation.setNotification(new AHNotification(), lastItemPos);</pre><pre>return true;<br>         }<br>     });</pre><p>To remove a notification, we set an EMPTY notification for that item. That is all there is to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/0*uWX1PcGPZTJetvAu.gif" /><figcaption>Dismissing notification badge</figcaption></figure><h3>Managing Bottom Navigation with Fragments</h3><p>It’s pretty obvious by now that each Bottom Bar’s item manages a Fragment.</p><p>To put it in other words, you could say it’s similar to <a href="http://blog.iamsuleiman.com/material-design-tabs-with-android-design-support-library/">Material Tabs with a </a><a href="http://blog.iamsuleiman.com/material-design-tabs-with-android-design-support-library/">ViewPager</a>. Except you can’t swipe.</p><h4>Maintaining Fragments with ViewPager</h4><p>Now that we’ve decided on using a ViewPager to handle our Fragments, we need to write an Adapter.</p><p>For that, we have two choices:</p><ol><li><a href="https://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter.html">FragmentPagerAdapter</a></li><li><a href="https://developer.android.com/reference/android/support/v4/app/FragmentStatePagerAdapter.html">FragmentStatePagerAdapter</a></li></ol><p>Now, depending on your use case, choosing between the two can make all the difference. But I’ll spare you all the rambling and state it simply.</p><blockquote>Using a <strong>FragmentStatePagerAdapter</strong> is more useful when there are a large number of pages. It holds on to much less memory associated with each visited page.</blockquote><p>Okay, our Bottom Navigation has three items, but it can go up to five. So considering the extreme scenario, we can have five resource-heavy Fragments. So you can do your app a favour and use a <strong>FragmentStatePagerAdapter</strong>.</p><p>But if you’re interested in knowing in depth, this SO post has all the answers.</p><p><a href="https://stackoverflow.com/questions/18747975/difference-between-fragmentpageradapter-and-fragmentstatepageradapter">Difference between FragmentPagerAdapter and FragmentStatePagerAdapter</a></p><h4>Creating the ViewPager Adapter</h4><p>There’s a ‘smart’ implementation of FragmentStatePagerAdapter that allows us to access already existing Fragments from the Adapter. So go ahead and grab it from this GitHub gist.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1a5868d2e5a37f1585473ef0340a27c0/href">https://medium.com/media/1a5868d2e5a37f1585473ef0340a27c0/href</a></iframe><p>Next, to actually use this, we need to create our Adapter that extends SmartFragmentStatePagerAdapter. So let’s call it <strong><em>BottomBarAdapter</em></strong>.</p><pre>public class BottomBarAdapter extends SmartFragmentStatePagerAdapter {<br>    private final List&lt;Fragment&gt; fragments = new ArrayList&lt;&gt;();<br><br>    public BottomBarAdapter(FragmentManager fragmentManager) {<br>        super(fragmentManager);<br>    }</pre><pre>    // Our custom method that populates this Adapter with Fragments<br>   <strong> public void addFragments(Fragment fragment) {<br>        fragments.add(fragment);<br>    }<br></strong><br>    @Override<br>    public Fragment getItem(int position) {<br>        return fragments.get(position);<br>    }<br><br>    @Override<br>    public int getCount() {<br>        return fragments.size();<br>    }<br>}</pre><p>Nothing fancy here. Just note the List&lt;Fragment&gt; that our Adapter uses here.</p><p><strong>NOTE:</strong><br>In future if you want to fetch a particular Fragment, you can do it using <strong>pagerAdapter.getRegisteredFragment(position)</strong>.</p><p>Now that our Adapter is ready, we need to connect it to the ViewPager. But wait. Not so fast!</p><p>There is one tiny change we need to do to the ViewPager. Swiping must be disabled.</p><h4>Disable swiping on ViewPager</h4><p>The easiest way is to create a custom ViewPager. So let’s create a new class extending ViewPager. I call it <strong><em>NoSwipePager</em></strong>, for the lack of a better name.</p><pre>public class NoSwipePager extends ViewPager {<br>    private boolean enabled;<br><br>    public NoSwipePager(Context context, AttributeSet attrs) {<br>        super(context, attrs);<br>        this.enabled = true;<br>    }<br><br>    @Override<br>    public boolean onTouchEvent(MotionEvent event) {<br>        if (this.enabled) {<br>            return super.onTouchEvent(event);<br>        }<br>        return false;<br>    }<br><br>    @Override<br>    public boolean onInterceptTouchEvent(MotionEvent event) {<br>        if (this.enabled) {<br>            return super.onInterceptTouchEvent(event);<br>        }<br>        return false;<br>    }<br><br>    public void setPagingEnabled(boolean enabled) {<br>        this.enabled = enabled;<br>    }<br>}</pre><p><strong>NOTE:</strong><br>Make sure you reference <em>NoSwipePager</em><strong><em> </em></strong>in your XML layout instead of a regular ViewPager.</p><p>Once, you initialize your ViewPager in Activity, you need to explicitly disable swiping. You can do it with a single line.</p><pre>viewPager.setPagingEnabled(false);</pre><p>With the previous step, our Adapter and ViewPager is now ready to roll. The final step is to create our Fragments, then pass them to the Adapter and finally connect the Adapter with ViewPager.</p><h4>Connecting ViewPager with PagerAdapter</h4><p>Let’s create a simple Fragment called <em>DummyFragment</em>. It accepts one argument “color”. Using a different color will tell us which Fragment instance is shown when we use the Bottom Navigation.</p><p>Once your Fragment is ready, let’s get to completing our ViewPager.</p><ol><li><strong>Set up </strong><strong>ViewPager</strong></li></ol><pre>// init UI<br>viewPager.setPagingEnabled(false);</pre><p><strong>2. Initialize PagerAdapter</strong></p><pre>pagerAdapter = new BottomBarAdapter(getSupportFragmentManager());</pre><p><strong>3. Create Fragments and add them to Adapter</strong></p><pre>Bundle bundle = new Bundle();<br>bundle.putInt(&quot;color&quot;, color);</pre><pre>DummyFragment fragment = new DummyFragment();<br>fragment.setArguments(bundle);</pre><pre>pagerAdapter.addFragments(fragment);</pre><p><strong>4. Finally, set the </strong><strong>ViewPager Adapter</strong></p><pre>viewPager.setAdapter(pagerAdapter);</pre><h3>Handling Click Events</h3><p>Hang in there, we’re almost done!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxUA7bf3sHeSuIKF1mg%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fkenny-good-job-cabin-boy-xUA7bf3sHeSuIKF1mg&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2FxUA7bf3sHeSuIKF1mg%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="295" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa9b57e2842fb97350483f334c5f4c46/href">https://medium.com/media/aa9b57e2842fb97350483f334c5f4c46/href</a></iframe><p>Since we disabled ViewPager swiping, the only way to switch Fragments is by clicking the Bottom Navigation Items. So we need to manually handle those click events!</p><p>Don’t worry, it’s dead simple. See for yourself!</p><pre>bottomNavigation.setOnTabSelectedListener(new AHBottomNavigation.OnTabSelectedListener() {<br>            @Override<br>            public boolean onTabSelected(int position, boolean wasSelected) {<br>                 <br>                 <strong>if (!wasSelected)</strong><br>                     <strong>viewPager.setCurrentItem(position);</strong></pre><pre>                 return true;<br>            }<br>        });</pre><p>The click listener provides us a useful boolean that tells us if the current click is happening on an already selected item. So we simply need to change the Fragment when this is NOT the case.</p><p>That’s all there is to it.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F26xBuwDvSNN9w8sda%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fmichaelbolton-26xBuwDvSNN9w8sda&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F26xBuwDvSNN9w8sda%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/099b25723fbf4e11bdfa7ad813da2b6a/href">https://medium.com/media/099b25723fbf4e11bdfa7ad813da2b6a/href</a></iframe><h3>Output</h3><p>Just to give you a visual on how all that code works, here’s a GIF of everything put together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/1*bOIdu7Z29daNtRdmFgY6fQ.gif" /></figure><h3>Where to, from here?</h3><p>The Bottom Navigation is the newest entry in Material Design. It pushes us to rethink our navigation structures.</p><p>At first, it might be confusing. But I hope this post has helped you decide when to use what.</p><p><strong>SOURCE CODE</strong> —<strong> </strong>Available on GitHub</p><p><a href="https://github.com/Suleiman19/Bottom-Navigation-Demo/blob/master/app/src/main/java/com/grafixartist/bottomnav/MainActivity.java">Suleiman19/Bottom-Navigation-Demo</a></p><h4><strong>Other Options</strong></h4><ol><li><a href="https://github.com/roughike/BottomBar"><strong>Bottom Navigation Bar by roughike</strong></a><br> Clearly its the more popular one. But this library seems to work just as fine, so there’s no cause for alarm.</li><li><a href="http://blog.iamsuleiman.com/using-bottom-navigation-view-android-design-support-library/"><strong>Official Bottom Navigation by Design Support Library</strong><br></a>However, it is very limited in options in terms of styling and customization.</li></ol><h4>Wrap Up</h4><p>So what do you think about Bottom Navigation? It is very common in iOS but I’m excited to see how we’re going to use it in Android.</p><p>A lot of Android apps have already adopted it (Instagram, Google+ and Quora to name a few). What about you? Let me know in the comments below.</p><p><em>Suleiman is a UX UI Designer &amp; App developer who loves creating simple, usable, yet beautiful experiences for people. He’s currently pursuing his Masters in UX Design at Rutgers, NJ. Check out his </em><a href="http://iamsuleiman.com/"><strong><em>portfolio</em></strong></a><em>.</em></p><p><em>Originally published at </em><a href="http://blog.iamsuleiman.com/bottom-navigation-bar-android-tutorial/"><em>blog.iamsuleiman.com</em></a><em> on March 22, 2016.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F3e491f%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F3e491f%2F&amp;image=http%3A%2F%2Fapi.screenshotlayer.com%2Fapi%2Fcapture%3Faccess_key%3Dfe59908dad3baab69ffab249a2224b03%26viewport%3D1024x612%26width%3D1000%26url%3Dhttps%253A%252F%252Fupscri.be%252F3e491f%253Fscreenshot&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/fedb9f91e907af2468a937c944ed32ab/href">https://medium.com/media/fedb9f91e907af2468a937c944ed32ab/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75e4efb8105f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-news/ultimate-guide-to-bottom-navigation-on-android-75e4efb8105f">Ultimate Guide to Bottom Navigation on Android</a> was originally published in <a href="https://medium.com/android-news">AndroidPub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a Parallax Scrolling Header with Tabs in Android]]></title>
            <link>https://medium.com/android-news/parallax-scrolling-header-tabs-android-tutorial-2cc6e40aa257?source=rss-83858f711e05------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cc6e40aa257</guid>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Suleiman Shakir]]></dc:creator>
            <pubDate>Tue, 15 Sep 2015 04:30:23 GMT</pubDate>
            <atom:updated>2017-04-17T05:44:01.643Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*3bymAxYPdl-06ASBVdCrow.png" /></figure><p>Material Design has seen the rise in on-scroll animations in Android apps. Certain designs include a parallax scroll effect with a header images, along with Tabs. In this post, we’ll look at just that.</p><p>Some examples of popular scrolling patterns include the <a href="http://blog.iamsuleiman.com/toolbar-animation-with-android-design-support-library/">Flexible Space with Image</a> and <a href="http://blog.iamsuleiman.com/quick-return-pattern-with-android-design-support-library/">Quick Return pattern</a>. Parallax scrolling is yet another scrolling technique. In this post, we’ll look at making parallax scrolling Tabs using Android Design Support Library.</p><p>Parallax scrolling has been very popular in web design and now in app development as well. I’ve seen quite a few people wanting to implement this and I wanted to provide a solution without using a third party library. So here it is.</p><p>Creating Parallax Scrolling on Android is nothing but the <strong>Flexible Space with Image pattern</strong>, with an added TabLayout.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ov3cTNTh8p0KR34zjgGVHg.png" /><figcaption>Parallax scrolling Tabs with Header</figcaption></figure><h3>Parallax Scrolling Tabs in Android</h3><p>Have you read the <a href="http://blog.iamsuleiman.com/toolbar-animation-with-android-design-support-library/">android tutorial for creating the Flexible Space with Image Pattern</a>? If you have, then you would immediately recognise that all this needs is a <strong>TabLayout</strong>.</p><p>For those who haven’t read it, don’t worry. I’ll walk you through everything in this article.</p><p>But wait, hold your horses! I just threw in the TabLayout and this is what I got.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*51D-FgjdhBf7VY2N.png" /><figcaption>Toolbar and Tabs overlap on collapse</figcaption></figure><p>Unlike the typical <a href="http://blog.iamsuleiman.com/material-design-tabs-with-android-design-support-library/">Material Design Tabs</a>, Tabs here are transparent. So clearly, the plug and play solution doesn’t work here.</p><p>It looks like some tweaks are required.</p><p>So before I straight away paste the entire code, let’s look at the layout skeleton.</p><pre>&lt;android.support.design.widget.CoordinatorLayout&gt; <br>   &lt;android.support.design.widget.AppBarLayout&gt;</pre><pre>      &lt;android.support.design.widget.CollapsingToolbarLayout&gt;<br>         &lt;ImageView /&gt;<br>         &lt;android.support.v7.widget.Toolbar /&gt;<br>         &lt;android.support.design.widget.TabLayout /&gt;<br>      &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;</pre><pre>&lt;/android.support.design.widget.AppBarLayout&gt;<br>&lt;/android.support.design.widget.CoordinatorLayout&gt;</pre><p>The <a href="https://developer.android.com/reference/android/support/design/widget/CollapsingToolbarLayout.html"><strong>CollapsingToolbarLayout</strong></a> is like a super FrameLayout. So take note of the ordering of elements inside. Whatever element you place last, is what appears on the top. This positioning is important to get the parallax scrolling to work.</p><p>Moreover, the ImageView is what makes the parallax scrolling possible. We can tell the ImageView to parallax scroll with a single attribute. More on this later.</p><p>So now that you have an idea of the layout structure, behold the full XML layout code!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b71c51e576033ebd7053cd9051dca9b8/href">https://medium.com/media/b71c51e576033ebd7053cd9051dca9b8/href</a></iframe><p>I know the code is really long. But it takes twice the effort to attempt a parallax effect using Java. So if you’ve recovered from the shock, let’s see what’s going on in the above code.</p><h3>Layout Breakdown</h3><p>Some of the attributes here are what make the parallax scroll work. Let’s go through them, one by one.</p><p><strong>21.</strong> The total height that we want our collapsible header View to have. <strong>256dp</strong> is a good number.</p><p><strong>25.</strong> This is not the <a href="http://blog.iamsuleiman.com/toolbar-animation-with-android-design-support-library/">Flexible Space with Image pattern</a>. We don’t want the Toolbar title to collapse. We want it fixed at the top. So we disable the ‘collapsible’ title.</p><p><strong>34.</strong> Flag which triggers the parallax effect upon scrolling.</p><p><strong>36–41 </strong>A Scrim that makes Tab text more readable against the busy header background.</p><p><strong>47.</strong> Remember that CollapsingToolbarLayout is an extension of FrameLayout. This attribute ensures the Toolbar stays on top.</p><p><strong>48.</strong> TabLayout by default has a height of <strong>48dp</strong>. Telling our Toolbar to have a bottom margin of the same, avoids the overlap issue that we saw above.</p><p><strong>49.</strong> Makes sure the Toolbar is consistently pinned to the top. Otherwise when you start scrolling, the Toolbar will scroll off-screen.</p><p><strong>56.</strong> Ensures the TabLayout sticks to the bottom of the header.</p><p>A visual breakdown of the layout will give you a better idea.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rd979yYprZ-bqsU3j98boQ.png" /><figcaption>Breakdown of layout metrics</figcaption></figure><h3>Set up the ViewPager</h3><p>In case you forgot, the Tabs need a ViewPager to work with, so let’s take care of that in our <strong>Activity.java</strong>.</p><p>Start by creating a dummy Fragment. For the sake of displaying some content, the Fragment will display a RecyclerView.</p><p>Additionally, the Fragment’s background colour will change depending on it’s position in the ViewPager.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c3405b3831393cdf1ffb57c00e80f907/href">https://medium.com/media/c3405b3831393cdf1ffb57c00e80f907/href</a></iframe><p>Note that <strong>DummyFragment</strong> is just a placeholder which I’m using with a different background colour for each of my Tabs. <em>DessertAdapter</em> is a RecyclerView.Adapter I wrote to display scrollable content that can demonstrate the parallax effect.</p><p>You on the other hand, must define a distinctFragment accordingly, for each of your Tabs.</p><h4>ViewPager Adapter</h4><p>A minimal Adapter for our ViewPager (to hold 3 Fragments).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/24a34e69a478b2071ebe63acc6a5be5b/href">https://medium.com/media/24a34e69a478b2071ebe63acc6a5be5b/href</a></iframe><p><strong>Hooking up ViewPager with TabLayout</strong></p><p>Finally we’ll attach the ViewPager to our TabLayout in the Activity’s <strong>onCreate()</strong> method. We use the <strong>OnTabSelectedListener</strong> to take care of switching Fragments on tap.</p><pre>...<br>tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {<br>            @Override<br>            public void onTabSelected(TabLayout.Tab tab) {</pre><pre>                <strong>viewPager.setCurrentItem(tab.getPosition());</strong>                         <br>                switch (tab.getPosition()) {<br>                    case 0:<br>                        // TODO<br>                    break;<br>                }<br>            }</pre><pre>            @Override<br>            public void onTabUnselected(TabLayout.Tab tab) { }</pre><pre>            @Override<br>            public void onTabReselected(TabLayout.Tab tab) {}</pre><pre>});<br>...</pre><p>Don’t forget to populate your ViewPager Adapter with your Fragments. I’m adding 3 Fragments to the Adapter, each named after it’s background colour.</p><pre>private void setupViewPager(ViewPager viewPager) {         <br>    <br>    ViewPagerAdapter adapter = new ViewPagerAdapter(<br>                               getSupportFragmentManager());        </pre><pre>    adapter.addFrag(new DummyFragment(                <br>        ContextCompat.getColor(this, R.color.cyan_50)), &quot;Cyan&quot;);        </pre><pre>    adapter.addFrag(new DummyFragment(                <br>        ContextCompat.getColor(this, R.color.amber_50)), &quot;Amber&quot;);        </pre><pre>    adapter.addFrag(new DummyFragment(                <br>        ContextCompat.getColor(this, R.color.purple_50)), &quot;Purple&quot;);        </pre><pre>    viewPager.setAdapter(adapter);    </pre><pre>}</pre><p>The <strong>setupViewPager()</strong> method simply initialises my Fragment and adds them to the ViewPager.</p><h4>Dynamic Tab colour with Palette API</h4><p>The colour you see the Toolbar + TabLayout take, is picked from the header image. Courtesy of the Palette API. This is dynamic and the colour varies depending upon the image.</p><p>Using the Palette API, we’ll set colours for the Toolbar, TabLayout and Status Bar. This is easily done by the following code snippet:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8e2069f4d879b7462ba67d5317895d5/href">https://medium.com/media/a8e2069f4d879b7462ba67d5317895d5/href</a></iframe><p>Notice that the actual Palette API calls reside in the <em>try</em> block. But it is good practice to always handle the fail case. Here, the Palette API can fail if we’re unable to get a Bitmap. So as a fallback, we resort to using our app’s primary colours.</p><h3>Final Output</h3><p>With everything in place, run your app and scroll to watch that beautiful parallax scrolling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*O5QqNPUVw6qE2lgY.gif" /><figcaption>Parallax scrolling Tabs output</figcaption></figure><p>We have a neat TabLayout that plays nice with our Toolbar. Our header image scrolls nicely and fades into our image’s primary vibrant colour.</p><p>As you can see this is a neat pattern in use which many of you would have seen. A perfect use case for this would be in apps that have categories. Like the Play Store app that have sub-categories.</p><h4>Before you go</h4><p>Did you notice the parallax scroll in that GIF? It’s really subtle and adds a layer of depth. If you want parallax to be more prominent, you can do so using a simple attribute.</p><p>Simply add this line to your ImageView.</p><pre>...<br>&lt;ImageView<br>    <strong>app:layout_collapseParallaxMultiplier=&quot;0.75&quot;</strong><br>    ...<br>/&gt;<br>....</pre><p>Just keep in mind the multiplier should range between 0.0 and 1.0. — <a href="https://developer.android.com/reference/android/support/design/R.attr.html#layout_collapseParallaxMultiplier">Android docs</a>.</p><p><strong>Source Code Available on GitHub</strong></p><p><a href="https://github.com/Suleiman19/Android-Material-Design-for-pre-Lollipop/blob/master/MaterialSample/app/src/main/java/com/suleiman/material/activities/TabsHeaderActivity.java">Suleiman19/Android-Material-Design-for-pre-Lollipop</a></p><p>So how are you using the Design Support Library? Do you have your own take on parallax scrolling? Let me know in the comments below.</p><p><em>Suleiman is an Android developer with an eye for design. He loves creating apps that people can use with ease. He actively writes such articles on </em><a href="http://blog.iamsuleiman.com/about/"><em>his blog</em></a><em>. Say hi on </em><a href="https://www.linkedin.com/in/suleiman-ali-shakir-18bb5651/"><em>LinkedIn</em></a><em> or </em><a href="https://twitter.com/Suleiman_194"><em>Twitter</em></a><em>.</em></p><p><em>Originally published at </em><a href="http://blog.iamsuleiman.com/parallax-scrolling-tabs-design-support-library/"><em>blog.iamsuleiman.com</em></a><em> on September 15, 2015.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F3e491f%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F3e491f%2F&amp;image=https%3A%2F%2Fupscri.be%2Fmedia%2Fform.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ae57c1b4448392f65f474b01a127fbf/href">https://medium.com/media/2ae57c1b4448392f65f474b01a127fbf/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cc6e40aa257" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-news/parallax-scrolling-header-tabs-android-tutorial-2cc6e40aa257">Create a Parallax Scrolling Header with Tabs in Android</a> was originally published in <a href="https://medium.com/android-news">AndroidPub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating the Flexible Space with Image Pattern on Android]]></title>
            <link>https://medium.com/android-news/creating-the-flexible-space-with-image-pattern-on-android-b5f8908b9921?source=rss-83858f711e05------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5f8908b9921</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-design]]></category>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Suleiman Shakir]]></dc:creator>
            <pubDate>Tue, 02 Jun 2015 19:04:52 GMT</pubDate>
            <atom:updated>2017-10-24T17:28:38.032Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Ur8GqhvuHU7uKFlDJsx1g.png" /></figure><p>The Design support library for Android makes it easy to create great animations. Let’s look at how to create an app with a collapsing Toolbar animation. It’s know as Flexible Space with Image pattern, a popular scrolling technique.</p><p>I didn’t know this pattern actually had a name until <a href="https://plus.google.com/+SuleimanAliShakir/posts/YeLRBoeoPJr">Ian Lake happened to point it out for me</a>.</p><h3>Flexible Space with Image Pattern</h3><blockquote>A scrolling technique that supports an image header with a scrollable view below it. Upon scrolling, the ‘Flexible Space’ (image header) gets tinted with a color. At the same time, it collapses into a Toolbar — <a href="https://material.io/guidelines/patterns/scrolling-techniques.html#scrolling-techniques-scrolling">Material Design guidelines</a></blockquote><p>This pattern is a popular scrolling technique. In familiar terms, you can see this in WhatsApp’s contact detail screen.</p><p>Here’s the step-by-step screenshots of the Flexible Space animation. Should give you a clear picture of what’s going on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fFordphWElj0dHgKjWq87w.png" /><figcaption>Flexible Space with Image Pattern — step by step</figcaption></figure><p>Notice the Toolbar dynamically changes color, depending on the image. It takes on the most dominant color present in the image.</p><p>We can do this with the Palette API, but more on that later.</p><p>You might immediately start to freak out with the amount of code it might take. But rest assured, there’s no scary Java code to write. Most of it is XML, so cheers to that!</p><h3>Getting Started</h3><p>Start by adding the Design Support Library to your <em>app/build.gradle</em> file.</p><pre>dependencies { <br>    … <br>    compile &#39;com.android.support:design:25.0.2&#39; <br>}</pre><h3>Layout Structure</h3><p>As always, we’ll get started with the XML first. Open your <strong>activity.xml</strong> layout.</p><p>Here’s the layout skeleton.</p><pre>&lt;android.support.design.widget.CoordinatorLayout &gt;</pre><pre>    &lt;android.support.design.widget.AppBarLayout &gt;</pre><pre>        &lt;android.support.design.widget.CollapsingToolbarLayout &gt;</pre><pre>            &lt;ImageView /&gt;</pre><pre>            &lt;android.support.v7.widget.Toolbar /&gt;</pre><pre>        &lt;/android.support.design.widget.CollapsingToolbarLayout&gt;<br>    &lt;/android.support.design.widget.AppBarLayout&gt;<br>    <br>    &lt;!-- Your scrollable content here --&gt;</pre><pre>&lt;/android.support.design.widget.CoordinatorLayout&gt;</pre><h4>Design Support UI Widgets</h4><p>I understand if all these layouts might appear new to you. But you won’t have to worry. I’ll do my best to explain them, in the easiest way.</p><p><a href="http://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.html"><strong>1. CoordinatorLayout</strong></a></p><p>A powerful FrameLayout that specifies behavior for child views for various interactions. It also allows anchoring of floating views in your layout.</p><p><a href="http://developer.android.com/reference/android/support/design/widget/AppBarLayout.html"><strong>2. AppBarLayout</strong></a></p><p>It is a special kind of vertical LinearLayout. It helps respond to its children’s scroll events (scroll gestures). Additionally, it’s responsible for implementing many features of Material Design’s AppBarLayout.</p><p>But, there’s one thing to note. Its usage relies on being a direct child within CoordinatorLayout. The layout skeleton above demonstrates this.</p><p><a href="http://developer.android.com/reference/android/support/design/widget/CollapsingToolbarLayout.html"><strong>3. CollapsingToolbarLayout</strong></a></p><p>It is a Toolbar wrapper which makes the ‘Flexible Space’ pattern possible. It collapses the image header while decreasing the expanded title to a Toolbar title.</p><p>What’s left is the ImageView which holds our actual header’s image and Toolbar which we’re familiar with.</p><p><strong>4. FloatingActionButton</strong></p><p>I’m sure you’re familiar with what a Floating Action Button is, aren’t you? Android gave it a thumbs up by giving us an official UI widget. It’s a part of the Design Support Library.</p><p>More on this later.</p><h3>Defining the XML Layout</h3><p>Alright, with that out of the way lets get to the actual XML.</p><p><em>A word of caution. The layout below might look threatening in size!</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2aa5dda08a337db5764681cb10691d7c/href">https://medium.com/media/2aa5dda08a337db5764681cb10691d7c/href</a></iframe><p>This is not complex code. XML just tends to be a little verbose. But you’re welcome to try replicating the Flexible Space scroll animation in Java. Then I’m sure you’d truly appreciate how easy the Design Support library is.</p><p>However, I have highlighted the essential lines you need to focus on.</p><p>What you need to know from this?</p><ul><li><em>line 24: </em>layout_scrollFlags<br>Tells the CollapsingToolbarLayout and its children, how to behave on a scroll.<br>Here’s what the flags mean, straight from the developer’s blog:</li></ul><ol><li><strong><em>scroll</em></strong><em>:<br></em>This flag should be set for all views that want to scroll off-screen. For views that do not use this flag, they’ll remain pinned to the top of the screen.</li><li><strong><em>exitUntilCollapsed</em></strong><em>:<br></em>Causes the view to scroll off until it is ‘collapsed’ before exiting</li><li><strong><em>snap</em></strong><em>:</em><br>Enables the expanded view to snap to either a collapsed state, or expanded state. There is no in-between state. If the View has been dragged more towards expanding, it expands completely. If its dragged more towards collapsing, the View collapses completely.</li></ol><ul><li><em>line 33</em>: layout_collapseMode<br> Indicates how the ImageView reacts while collapsing on-scroll.<br> There are 2 collapse modes:</li></ul><ol><li>COLLAPSE_MODE_PARALLAX (use for ImageView)</li><li>COLLAPSE_MODE_PIN (use for Toolbar)</li></ol><ul><li><em>line 63</em>: layout_behavior<br> The CoordinatorLayout performs most of its magic using <a href="https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior.html"><strong>Behavior</strong></a>. Behaviors tell how its child Views must interact with each other.</li></ul><blockquote>A Behavior implements one or more interactions that may include drags, swipes, flings, or any other gestures.</blockquote><ul><li><em>line 73</em>: layout_anchor<br> Remember we spoke about anchoring Views earlier? This attribute tells FloatingActionButton to anchor’ itself to AppBarLayout.</li><li><em>line 74</em>: layout_anchorGravity<br> This attribute tells our View where to position itself, with respect to its ‘anchored’ View. In this case, this attribute tells our FAB, to position itself to the bottom right of the AppBarLayout.</li></ul><p>Here’s what the Android Studio’s Preview pane shows us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*oN6pTMzB8ishqZvMx_p5Qg.png" /><figcaption>Flexible Space with Image Pattern — XML Layout Preview</figcaption></figure><p>But wait. Does the expanded title look clear enough to you? I’m sure it’s not.</p><p>Whenever you display a label (TextView) against a background image, use a ‘<em>scrim</em>‘. It will help make the text more readable.</p><h4>TIP: Use a Scrim for clear, readable text</h4><blockquote><em>A Scrim is a semi-transparent gradient layer that helps text appear more readable against backgrounds.</em></blockquote><p>Just below your ImageView, add a simple View with a gradient Drawable as background.</p><pre>&lt;View <br>    android:layout_width=&quot;match_parent&quot; <br>    android:layout_height=&quot;160dp&quot; <br>    android:layout_gravity=&quot;bottom&quot;               <br>    android:background=&quot;@drawable/scrim&quot;/&gt;</pre><p>Here’s the Drawable scrim.</p><pre>&lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>       android:shape=&quot;rectangle&quot;&gt;<br>    &lt;gradient<br>        android:angle=&quot;90&quot;<br>        android:endColor=&quot;@android:color/transparent&quot;<br>        android:startColor=&quot;#66000000&quot;/&gt;<br>&lt;/shape&gt;</pre><p>That’s a gradient with 40% opacity black from the bottom, to transparent at the top. 66 is the HEX code for 40%.</p><p>If you want to play around transparency in hex codes, this wonderful StackOverflow answer helps.</p><p><a href="http://stackoverflow.com/a/39128318/4344964">How to make a background transparent 20% in android</a></p><p>So with the gradient applied, see the difference for yourself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZfHLvEM2jn_Yv_buIUQ14w.png" /><figcaption><em>AppBar without and with Scrim</em></figcaption></figure><p>While the difference is subtle, the right one’s much better right? Additionally, you can apply another scrim for the Toolbar. It can help the back and overflow icons be more visible. I leave this as an exercise for you.</p><p>I’ve already mentioned a hint above on parallax scroll. But there’s more to it.</p><h4>Getting the Parallax scroll right</h4><p>We can achieve parallax scrolling with ImageView by setting its layout_collapseMode to <strong>parallax</strong>.</p><blockquote><em>Parallax Scrolling involves the background moving at a slower rate to the foreground. — </em><a href="http://www.creativebloq.com/web-design/parallax-scrolling-1131762"><em>Creativebloq.com</em></a></blockquote><p>Did you notice an extra collapse mode attribute for the Toolbar?</p><p>Yes, you must use this as well. Why? Because, while the ImageView should collapse, the Toolbar must persist on scrolling.</p><p>Toolbar must use collapseMode:pin, because we want it to persist and remain on top, as the user scrolls down.</p><p>Note that I haven’t set any color for the Toolbar. The CollapsingToolbarLayout takes care of this. It dynamically picks up a color from our image and sets it to the Toolbar.</p><p>If you’re interested in Parallax scrolling with Tabs instead, this one’s for you.</p><p><a href="http://blog.iamsuleiman.com/parallax-scrolling-tabs-design-support-library/">Parallax Scrolling Tabs with Android Design Support Library</a></p><h3>Floating Action Button</h3><blockquote><strong>Floating action buttons</strong> are used for a promoted <strong>action</strong></blockquote><p>I’ll stick to calling it FAB from now on. If you tried to create a FAB earlier, you’d realize how hard it was.</p><p>But with the Design Support Library, that’s not the case anymore. The layout above shows, how easy it is!</p><p>Notice that I haven’t explicitly defined a size for the FAB. By default, it takes its regular width and height of <strong>56dp</strong>. But, you can define this by using the following attribute.</p><pre>app:fabSize=&quot;regular&quot;</pre><p>Optionally, you can set the fabSize as <em>mini</em>, which is a miniature version of the FAB at <strong>40dp</strong> in size.</p><p>Next in the layout, we align the FAB with AppBarLayout. We do this with the <strong>layout_anchor</strong> attribute.</p><pre>&lt;android.support.design.widget.FloatingActionButton<br>        ...<br>        app:layout_anchor=&quot;@+id/appbar&quot;<br>        app:layout_anchorGravity=&quot;bottom|right|end&quot; /&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S2YLJZNPOh3zQazHAoRTOA.png" /><figcaption>Anchoring FAB to AppBarLayout</figcaption></figure><p>That’s a wrap for the XML part. The good news is, this XML is all that’s required to trigger the Flexible Space scroll animation.</p><p>But wait! There’s still one thing that seems a bit off. What about the FAB’s action?</p><p>After scrolling, the ‘Add’ action goes hidden. It becomes available, only when you scroll all the way to the top. This is a bit inconvenient isn’t it? So let’s fix that.</p><h3>The Hidden Action</h3><p>Once the AppBar collapses, we need to show the FAB’s action somewhere.</p><p>Now I’m not saying this is the recommended approach. But my suggestion is that once the FAB vanishes, we add the action to the Toolbar’s menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*COS9PgNcRQEcoXhi.gif" /><figcaption>Add FAB Menu Item to Toolbar after collapse</figcaption></figure><p>To do this we’ll need a listener first. We have to listen to AppBarLayout expand and collapse states. To be precise, we need <strong>AppBarLayout.OffsetChangedListener</strong>.</p><p>If the AppBarLayout’s ‘<strong>verticalOffset</strong>’ is zero, then its fully expanded. So when the verticalOffset is almost equal to the fully expanded height, add the action to Toolbar’s menu.</p><p>First, let’s look at how to set the listener.</p><pre>appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {<br>            @Override<br>            public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {<br>                //  Vertical offset == 0 indicates appBar is fully  expanded.<br>                if (Math.abs(verticalOffset) &gt; 200) {<br>                    appBarExpanded = false;<br>                    invalidateOptionsMenu();<br>                } else {<br>                    appBarExpanded = true;<br>                    invalidateOptionsMenu();<br>                }<br>            }<br>        });</pre><p>Some key takeaway points from the above code snippet.</p><ol><li>verticalOffset<br>returns negative values, so we wrap it with Math.abs(verticalOffset) .</li><li>appBarExpanded<br>a boolean that tells us when AppBarLayout is expanded or collapsed.</li><li>invalidateOptionsMenu()<br>called every time AppBarLayout’s height crosses a threshold (200 in our case).</li></ol><h4>Updating the Toolbar Menu</h4><p>invalidateOptionsMenu() helps update our Toolbar Menu. But we need to tell our Menu when to add and remove the extra Action.</p><p>First, we need a reference for the existing Menu. You can get this from the onCreateOptionsMenu() method.</p><pre>@Override<br>  public boolean onCreateOptionsMenu(Menu menu) {<br>      getMenuInflater().inflate(R.menu.menu_main, menu);<br>      collapsedMenu = menu;<br>      return true;<br>  }</pre><p>collapsedMenu is a global variable of type Menu. It allows us to keep a copy of the original Menu.</p><p>Next, we need to update our Menu. We’re already calling invalidateOptionsMenu() in the scroll listener. This will trigger the onPrepareOptionsMenu() method. Hence, we’ll add our dynamic Menu logic here.</p><pre>@Override<br>    public boolean onPrepareOptionsMenu(Menu menu) {<br>        if (collapsedMenu != null<br>                &amp;&amp; (!appBarExpanded || collapsedMenu.size() != 1)) {<br>            //collapsed<br>            collapsedMenu.add(&quot;Add&quot;)<br>                    .setIcon(R.drawable.ic_action_add)<br>                    .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);<br>        } else {<br>            //expanded<br>        }<br>        return super.onPrepareOptionsMenu(collapsedMenu);<br>    }</pre><p>You’ll notice that I haven’t done anything for the expanded state. We don’t need to either. I’ll tell you why.</p><p>After onPrepareOptionsMenu(), the onCreateOptionsMenu() is called. What do we need to do in the expanded state? The FAB becomes visible, which means we should hide the ‘Add’ action from Toolbar menu.</p><p>onCreateOptionsMenu() inflates the original Menu again. So we don’t have to worry about removing the action ourselves.</p><p>So now, when the FAB hides, its Action is added to Toolbar Menu. When the AppBarLayout collapses, the ‘Add’ action becomes visible in the Toolbar Menu.</p><p>Now all that remains is to do the usual UI initialization in Java. So let’s setup our Toolbar first. Then we’ll call in the Palette API.</p><h4>Setting up the basic UI</h4><p>We need to initialize our Toolbar first and then the CollapsingToolbarLayout . So open your<em> Activity.java</em> and type away. Or you can copy-paste this instead.</p><pre>toolbar = (Toolbar) findViewById(R.id.anim_toolbar);<br>setSupportActionBar(toolbar);</pre><pre>collapsingToolbar = (CollapsingToolbarLayout)    findViewById(R.id.collapsing_toolbar);<br>collapsingToolbar.setTitle(&quot;Suleiman Ali Shakir&quot;);</pre><pre>ImageView header = (ImageView) findViewById(R.id.header);</pre><p>Now you might ask me, why I have set a title for CollapsingToolbarLayout, instead of Toolbar? That’s a valid question.</p><p>Take a look at the Flexible Space with Image scroll animation. Yes, the GIF which I shared at the beginning of this post. Notice there’s an expanded title, which on scrolling, collapses into the Toolbar title.</p><p>The CollapsingToolbarLayout handles this for us. Hence we set the title for that, instead of a Toolbar.</p><p>Additionally, the CollapsingToolbarLayout also handles tinting our Toolbar using the Palette API. So let’s look at that next.</p><h3>Dynamic Colors with Palette API</h3><blockquote><em>The palette API is a support library that extracts prominent colors from images.</em></blockquote><p>The Palette API offers several color options (variations). Here are the basic four:</p><ul><li>Light</li><li>Dark</li><li>Vibrant</li><li>Muted</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J6wtwao22eqGpgC0jB-hEg.png" /><figcaption><em>Image credits: </em><a href="https://developer.android.com/training/material/palette-colors.html"><em>developer.android.com</em></a></figcaption></figure><p>To use the Palette library, we first need to add it to your project. So open up your <em>app/build.gradle</em> and add the following line.</p><pre>dependencies {<br>    …<br>    compile &#39;com.android.support:palette-v7:25.0.2&#39;<br>}</pre><h4>Using the Palette API</h4><p>First, pass the ‘header’ ImageView’s bitmap to the Palette API. Then the API will generate colors based on the header image, in an AsyncTask.</p><p>Once it completes, we can fetch a color we want and set it to CollapsingToolbarLayout. This, in turn, tints our Toolbar to our chosen color, when we scroll.</p><p>Let’s look at some code.</p><pre>Bitmap bitmap = BitmapFactory.decodeResource(getResources(),<br>                R.drawable.header);<br>        Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() {<br>            <a href="http://twitter.com/Override">@Override</a><br>            public void onGenerated(Palette palette) {<br>                mutedColor = palette.getMutedColor(R.attr.colorPrimary);<br>                collapsingToolbar.setContentScrimColor(mutedColor);<br>            }<br>        });</pre><p>I am fetching my bitmap from my resources directory.</p><p>But, in a real-world scenario, you would be downloading the image from an URL. Then saving it as a bitmap and passing that to the Palette API.</p><p>You can also increase the number of colors generated from the image. Or you can even retrieve the entire color swatch! If you’re interested in playing around with the Palette API, <a href="https://chris.banes.me/2014/10/20/palette-v21/">Chris Banes’ post</a> is a great article.</p><h3>Toolbar Animation in Action</h3><p>Finally, we’ve completed what’s needed for the Toolbar animation. In fact, much more than what’s required! So go ahead, run your app and watch the magic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*ZXPHQv56F28Lw3S6.gif" /><figcaption>Toolbar animation output</figcaption></figure><p>Notice the blue color the Toolbar takes after collapsing? That’s the ‘<em>mutedColor</em>’ generated from the image, by the Palette API.</p><p>To be honest, it was surprising to see such a smooth Toolbar animation. Even the FAB beautifully reacts upon touch with a higher elevation.</p><p><strong>Source Code available on GitHub</strong></p><p><a href="https://github.com/Suleiman19/Android-Material-Design-for-pre-Lollipop/blob/master/MaterialSample/app/src/main/java/com/suleiman/material/activities/AnimateToolbar.java">Suleiman19/Android-Material-Design-for-pre-Lollipop</a></p><p>Material Design is a powerful visual language that can help you design a brilliant app.</p><p>In Android, the Design Support Library makes it easy to create powerful animations, like this one. It allows us to create rich app experiences our users can enjoy.</p><p>So how are you using the Design Support Library? Do you have your own take on the ‘Flexible Space with Image’ animation pattern? Let me know in the comments below.</p><p><em>Suleiman is a UX UI Designer &amp; App developer who loves creating simple, usable, yet beautiful experiences for people. He’s currently pursuing his Masters in UX Design at Rutgers, NJ. Check out his </em><a href="http://iamsuleiman.com/"><strong><em>portfolio</em></strong></a><em>.</em></p><p><em>Originally published at </em><a href="http://blog.iamsuleiman.com/toolbar-animation-with-android-design-support-library/"><em>blog.iamsuleiman.com</em></a><em> on June 2, 2015.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F3e491f%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F3e491f%2F&amp;image=https%3A%2F%2Fupscri.be%2Fmedia%2Fform.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ae57c1b4448392f65f474b01a127fbf/href">https://medium.com/media/2ae57c1b4448392f65f474b01a127fbf/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5f8908b9921" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-news/creating-the-flexible-space-with-image-pattern-on-android-b5f8908b9921">Creating the Flexible Space with Image Pattern on Android</a> was originally published in <a href="https://medium.com/android-news">AndroidPub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>