Tag Archives: android

paddingLeft vs paddingStart

So, in the last few days, several teammates have asked me what is the difference between paddingLeft and paddingStart. So, I have written this to document my experience.

Why use paddingStart?

paddingRelative, paddingStart and paddingEnd are added in API 17 to support RTL devices. When your phone is switched to a RTL language, every view should be a mirror image of LTR mode.

In a LTR language, paddingStart is on the left and paddingEnd is on the right. In a RTL language (Arabic, Hebrew), it’s the opposite. If you only define paddingLeft and paddingRight and not start and end, then the layout would not be a mirror image in a RTL phone.


LTR language phone


RTL language phone


When to use paddingStart?

paddingStart and paddingEnd are equivalent to paddingLeft and paddingRight in API 17+ devices. Remember to add paddingStart and paddingEnd in these situations:

  • When paddingLeft and paddingRight are different.
  • Your app needs to support API 17+ devices with RTL.


How to use paddingStart and paddingEnd?

  • If paddingLeft and paddingRight are the same, you are done.
  • Otherwise, wherever you see a paddingLeft, put a paddingStart with it, same for right-end.
  • Do not remove paddingLeft and paddingRight from xml file (until the day we decide we will stop supporting API 16- devices).
        android:paddingLeft="@dimen/start_padding" />


I used paddingStart and paddingEnd and now QA tells me that my padding is broken in ICS/JB devices.

RTL support is added in API 17, so it’s still necessary to define paddingLeft and paddingRight in your xml. paddingStart and paddingEnd will override those values in API 17+ device.

Ok, it fails the lint test. Are you lying to me?

As I have said in “Why use paddingStart?”, paddingStart (etc) are added in API 17. So it’s normal for lint test to fail. Here’s a few solutions:

  • Equal left and right paddings
    • If left padding is equal to right padding, then we don’t need to define start and end paddings.
  • Suppress the lint error
  • Have a separate style file
    • Define a values-v17 folder
    • Place start and end in values-v17
    • Keep left and right in values.
Leave a comment

Posted by on March 19, 2016 in Android App, Uncategorized


Tags: , , , , , , ,

Ukulele Android Application

I have tried many “music”/”ukulele” related Android apps. Some are good, some are bad. These are some free must-have Android Apps that all ukulele users should have:

  • Ukulele Tabs (allow you to search for song tabs, require internet access, con: no lyrics)
  • DaTuner Lite (chromatic tuner, con: sometimes my phone freeze using this app…)
  • gStrings (chromatic tuner, con: sometimes my phone freeze using this app too…)
  • My Ukulele (*BEST* virtual ukulele, quite handy if you don’t have a uke around)
  • Ukulele Chords (an app that provides chord shapes)
  • Ukulele Fretboard (similar to Ukulele Chords)
  • Ukulele Tuner (an app that only plays gCEA tune, good if you want to tune by ears)
  • Mobile Metronome (I have tried a few metronome app and so far, this one is the best)
There are a few “combined” tuner/metronome/chord apps, but they are not working nearly as well as the separate ones (especially when you are comparing those metronomes to Mobile Metronome). Plus those ones are made for guitar, so to change to gCEA tuning… that’s a pain.

Posted by on March 22, 2012 in Android App, Ukulele Stuff


Tags: , , , , , , ,