<?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 Ray Li on Medium]]></title>
        <description><![CDATA[Stories by Ray Li on Medium]]></description>
        <link>https://medium.com/@RayLiVerified?source=rss-a0b23248d0e3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*DDXi_w_xJvLT3NhP.jpeg</url>
            <title>Stories by Ray Li on Medium</title>
            <link>https://medium.com/@RayLiVerified?source=rss-a0b23248d0e3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 01:04:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@RayLiVerified/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[Create a Bottom Navigation Bar the Easy Way (Part 1)]]></title>
            <link>https://medium.com/@RayLiVerified/create-a-bottom-navigation-bar-the-easy-way-part-1-ec2f5f9122b?source=rss-a0b23248d0e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec2f5f9122b</guid>
            <category><![CDATA[android-design]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[twitter]]></category>
            <dc:creator><![CDATA[Ray Li]]></dc:creator>
            <pubDate>Sun, 10 Feb 2019 21:38:42 GMT</pubDate>
            <atom:updated>2019-02-10T21:38:42.852Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*_aNaM5-G9nSxAju7yYbROA.gif" /><figcaption>Good enough for Twitter, good enough for us!</figcaption></figure><p>Today, let’s create Twitter’s Bottom Navigation Bar with icons that fill in with color when selected.</p><p><em>But first, a bit of background info…</em></p><p>Google’s finally moved away from the Drawer Menu as the primary method of navigation towards something much better in the form of the Bottom Navigation Bar.</p><p>Unlike most of Google’s Material Design guidelines, Google actually provides us a <a href="https://material.io/design/components/bottom-navigation.html#">Bottom Navigation Bar</a> component for us to use in our apps. Thanks Google…</p><p><strong>…or not.</strong></p><p>Unfortunately, the default Bottom Navigation Bar Google gives us in the Material Components (com.google.android.material) library is extremely limited and quite unusable in a production app. Plainly put, it is really terrible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/0*u6PvLU1xbAbMBOmi.jpg" /><figcaption>Google’s Material Design Team cruzin’</figcaption></figure><p>Fortunately, enough apps require a bottom navigation view and the problem is common place enough that there are a plethora of options to choose from when searching for replacement libraries on Github. After trying out most of the available options, I’m happy to say I’ve found the one that works the best. Say hello to…</p><p><a href="https://github.com/ittianyu/BottomNavigationViewEx"><strong><em>BottomNavigationViewEx</em></strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*7aB7Kt06qowUYMfWC40lLA.jpeg" /></figure><p>Here’s what I love about this library:</p><ul><li>Lots of customization options</li><li>Labels/no labels</li><li>Change icon size, or hide icons altogether</li><li>Shifting animation control</li><li>Color/tint control</li><li><strong>Center Floating Action Button</strong></li><li><strong>Viewpager Support</strong></li><li><strong>Fancy Badges!</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*r5I9lm68lF4G1Y3vckQ9fQ.gif" /><figcaption>Who knew badges could be so fun and addicting?</figcaption></figure><p>Last, but perhaps most importantly, this library <em>extends</em> Google’s BottomNavigationView which means it effortlessly integrates with the new JetPack Navigation Architectural component.</p><p>Let’s see how we can use this library to replicate Twitter’s bottom bar.</p><h4>Step 1 / Import Library</h4><p>Import BottomNavigationViewEx into your project by copying this line into your app’s build.gradle file.</p><pre>dependencies {<strong><br>    </strong>api &#39;com.github.ittianyu:BottomNavigationViewEx:2.0.2&#39;<strong><br></strong>}</pre><p>The library is served by Jitpack so add Jitpack for the library to be found by Gradle.</p><pre>allprojects {<br>	repositories {<br>		maven { url &quot;https://jitpack.io&quot; }<br>	}<br>}</pre><p>Finally, if you’re using AndroidX, add the following config options to gradle.properties.</p><pre>android.useAndroidX=true<br>android.enableJetifier=true</pre><h4>Step 2/ Declare Bottom Menu in XML</h4><p>Next, let’s layout the bottom bar view in XML. Here, I’m putting the bottom bar in my MainActivity and aligning it at the bottom by wrapping it in a RelativeLayout.</p><pre><em>activity_main.xml</em></pre><pre>&lt;<strong>RelativeLayout<br>      android:id=&quot;@+id/main_activity_layout&quot;<br>      android:layout_width=&quot;match_parent&quot;<br>      android:layout_height=&quot;match_parent&quot;</strong>&gt;<br><br>   &lt;<strong>com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx<br>         android:id=&quot;@+id/bottom_bar&quot;<br>         android:layout_width=&quot;match_parent&quot;<br>         android:layout_height=&quot;wrap_content&quot;<br>         android:layout_alignParentBottom=&quot;true&quot;<br>         android:background=&quot;@android:color/white&quot;<br>         app:itemIconTint=&quot;@color/tab_selector&quot;<br>         app:labelVisibilityMode=&quot;unlabeled&quot;<br>         app:menu=&quot;@menu/menu_bottom_nav&quot;</strong>/&gt;<br>&lt;/<strong>RelativeLayout</strong>&gt;</pre><p>Twitter’s bottom bar does not have labels and it looks much cleaner that way. Disable labels by setting the library property labelVisibilityMode to unlabled.</p><h4>Step 3/ Create Bottom Menu Resource</h4><p>BottomNavigationViewEx extends the Android framework which means we can declare tabs using menu resources. Create a Menu Resource in your res/menu folder using the following code.</p><pre><strong><em>menu_bottom_nav.xml</em></strong></pre><pre><em>&lt;?</em><strong>xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;</strong><em>?&gt;<br></em>&lt;<strong>menu xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;</strong>&gt;<br>    &lt;<strong>item<br>            android:id=&quot;@+id/homeFragment&quot;<br>            android:checked=&quot;true&quot;<br>            android:icon=&quot;@drawable/ic_home_selector&quot;<br>            android:title=&quot;@string/home_title&quot;</strong>/&gt;<br>    &lt;<strong>item<br>            android:id=&quot;@+id/momentsFragment&quot;<br>            android:icon=&quot;@drawable/ic_search_selector&quot;<br>            android:title=&quot;@string/moments_title&quot;</strong>/&gt;<br>    &lt;<strong>item<br>            android:id=&quot;@+id/notificationsFragment&quot;<br>            android:icon=&quot;@drawable/ic_notifications_selector&quot;<br>            android:title=&quot;@string/notifications_title&quot;</strong>/&gt;<br>    &lt;<strong>item<br>            android:id=&quot;@+id/messagesFragment&quot;<br>            android:icon=&quot;@drawable/ic_messages_selector&quot;<br>            android:title=&quot;@string/messages_title&quot;</strong>/&gt;<br>&lt;/<strong>menu</strong>&gt;</pre><h4>Step 4/ Import Twitter Colors</h4><p>To customize our Bottom Navigation View and make it look like Twitter’s, we need to use Twitter’s colors.</p><p>First, let’s get Twitter’s bottom tab colors. Twitter used their brand color for the selected tab and dark gray for the unselected state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*W919Cmyyde_ASP1fs0l4HA.jpeg" /><figcaption>#1DA1F2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*tPRoF9zFkRMeRWHOLmicPw.jpeg" /><figcaption>#657786</figcaption></figure><pre><em>colors.xml</em></pre><pre>&lt;<strong>color name=&quot;twitter_blue&quot;</strong>&gt;#1da1f2&lt;/<strong>color</strong>&gt;<br>&lt;<strong>color name=&quot;deep_gray&quot;</strong>&gt;#ff657786&lt;/<strong>color</strong>&gt;</pre><pre>&lt;<strong>color name=&quot;tab_selected&quot;</strong>&gt;@color/twitter_blue&lt;/<strong>color</strong>&gt;</pre><p>Create a color state list selector so the bottom bar can automatically apply the correct color to our tabs based on their selection state.</p><pre><em>tab_selector.xml</em></pre><pre><em>&lt;?</em><strong>xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;</strong><em>?&gt;<br></em>&lt;<strong>selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;</strong>&gt;<br>   &lt;<strong>item android:color=&quot;@color/tab_selected&quot; android:state_checked=&quot;true&quot; </strong>/&gt;<br>   &lt;<strong>item android:color=&quot;@color/deep_gray&quot; android:state_checked=&quot;false&quot;</strong>/&gt;<br>&lt;/<strong>selector</strong>&gt;</pre><h4>Step 5/ Import Twitter Icons</h4><p>It’s pretty difficult to replicate Twitter’s Bottom Bar without Twitter’s icons. Download those icons from this link:</p><blockquote><a href="https://www.mediafire.com/folder/2t06cmke9lt7i/Twitter_Bottom_Bar_Icons">https://www.mediafire.com/folder/2t06cmke9lt7i/Twitter_Bottom_Bar_Icons</a></blockquote><p>One very unique “upgrade” that Twitter made was to use two different versions of their icons in addition to changing the icon color when selected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*p5IECyYaHLpQoYcjsj1mMw.jpeg" /></figure><p>In my opinion, this makes the icons more dynamic and is a nice additional microinteraction.</p><p>Like with the colors before, we can leverage a drawable selector to automatically switch between icon states.</p><pre><em>ic_search_selector.xml</em></pre><pre><em>&lt;?</em><strong>xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;</strong><em>?&gt;<br></em>&lt;<strong>selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;</strong>&gt;<br>   &lt;<strong>item android:drawable=&quot;@drawable/ic_search_selected&quot; android:state_checked=&quot;true&quot;</strong>/&gt;<br>   &lt;<strong>item android:drawable=&quot;@drawable/ic_search&quot; android:state_checked=&quot;false&quot;</strong>/&gt;<br>&lt;/<strong>selector</strong>&gt;</pre><h4>Step 6/ Customize Bottom Bar Programmatically</h4><p>At this point, the bottom bar is created in XML and appears when we run our app. However, the selected tab’s icon is larger and shifts when the selection changes. Currently, there’s no XML option to disable that shifting so we need to do it programmatically.</p><p>Copy the following function into the activity with the bottom bar and call it in onCreate</p><pre><em>MainActivity</em></pre><pre><strong>private fun </strong>initBottomBar() {<em><br>        </em>bottom_bar.enableItemShiftingMode(<strong>false</strong>)<br>        bottom_bar.enableAnimation(<strong>false</strong>)<br>    }</pre><p>Reload the app via Instant Run and voila!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*4G6L1eHJWuzgFWbOGWPcPA.gif" /><figcaption>Great work!</figcaption></figure><p>The next article will cover how to add notification badges to bottom bar tabs. Follow me to be notified :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*dfCVHU8rXywgfjksPB0oYQ.jpeg" /><figcaption>Everyone loves those notification dots, so yummy!</figcaption></figure><p><em>Would it help to have access to all the files together in a Git repo? If so, mash that clap button to let me know this article was helpful!</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FqA9BnxUPmgWgU%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FqA9BnxUPmgWgU%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FqA9BnxUPmgWgU%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="213" frameborder="0" scrolling="no"><a href="https://medium.com/media/208f206381232a25ec4bf49ab5e4a7c6/href">https://medium.com/media/208f206381232a25ec4bf49ab5e4a7c6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec2f5f9122b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a Rounded Image Icon with Ripple Effect in Flutter]]></title>
            <link>https://medium.com/@RayLiVerified/create-a-rounded-image-icon-with-ripple-effect-in-flutter-eb0f4a720b90?source=rss-a0b23248d0e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb0f4a720b90</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Ray Li]]></dc:creator>
            <pubDate>Tue, 19 Jun 2018 16:01:14 GMT</pubDate>
            <atom:updated>2018-06-19T16:01:14.262Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*KypR1CnfqQAOzcf_Kux9tQ.png" /></figure><p>Creating a circular image button with a Material splash effect in Flutter should be easy, and once you know how, it is! Hopefully, this tutorial on how to create a rounded image button in Flutter will save you the three hours I spent :)</p><p>Why do we need an entire article on how to make an image round? Well, if you’re interested in making it look nice and react to touch, read on to find out! But first, there’s quite a bit of interesting history behind rounded images. For one, they used to not exist!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*LwbkMDFBYkaBPS4GsGqLRg.png" /><figcaption>Images used to be square, the horror!</figcaption></figure><p>Just a few years ago, people were still using square image icons. Now, we live in much more civilized times so circular image icons it is!</p><p>In the early days of Android, creating creating circular image icons was much more difficult than it should have been. It was a huge problem that consumed many hours of productivity and had many creative solutions. This is evidenced by the fact that some of the most starred Android libraries on Github are dedicated to creating rounded images.</p><p>10,000 stars — <a href="https://github.com/hdodenhof/CircleImageView">https://github.com/hdodenhof/CircleImageView</a></p><p>5,000 stars — <a href="https://github.com/vinc3m1/RoundedImageView">https://github.com/vinc3m1/RoundedImageView</a></p><p>Thankfully, Flutter comes with great built in widgets that give us all the tools we need to create beautiful circular images, with touch effects and drop shadows too!</p><p>Without further ado, let’s build this beautiful image icon:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/239/1*U8_90Kf74Oc0xRF8iOV6jw.png" /><figcaption>Looks great if I say so myself!</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eaefe291a8a51635c53a7e83657c704b/href">https://medium.com/media/eaefe291a8a51635c53a7e83657c704b/href</a></iframe><p>The magic here is wrapping the `InkWell` in an `Ink.image()` decoration. That gives us the nice Material ink splash we want when the user touches the image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/1*ab8al8t02u0ENw-g5gJvPA.gif" /></figure><p>Using a InkWell without a Ink decoration hides the splash effect. This happens because of the properties of the InkWell widget and the order in which layout items are rendered.</p><p>An InkWell “must have a Material widget as an ancestor” because the ink effect is drawn on the material itself. This presents a problem when you have an image as the child of an InkWell because the image covers the material!</p><p>Flutter renders views in descending order so from bottom to top, you have Material &gt; InkWell &gt; Image. The image obscures the Material so ink effects on the material are not visible. To the user, it looks like nothing is happening.</p><p>Find out more about the Ink decoration here: <a href="https://docs.flutter.io/flutter/material/Ink-class.html">https://docs.flutter.io/flutter/material/Ink-class.html</a></p><p>The next article will cover how to select user images and load them into the circle icon. Follow me to be notified :)</p><p>Additional references:<br><a href="https://github.com/flutter/flutter/issues/3782">https://github.com/flutter/flutter/issues/3782</a></p><p><a href="https://github.com/flutter/flutter/pull/13900">https://github.com/flutter/flutter/pull/13900</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb0f4a720b90" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>