RSS

Category Archives: Uncategorized

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

LTR language phone

RTL

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).
    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/vertical_padding"
        android:paddingEnd="@dimen/end_padding"
        android:paddingRight=""@dimen/end_padding"
        android:paddingBottom="@dimen/vertical_padding"
        android:paddingStart="@dimen/start_padding"
        android:paddingLeft="@dimen/start_padding" />

Troubleshoot

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.
Advertisements
 
Leave a comment

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

 

Tags: , , , , , , ,

Chocolate Tour @ San Francisco

Last weekend I went to San Francisco to stay at Maria’s. We went on the chocolate tour. More pictures, less text. So much fun…

 
Leave a comment

Posted by on January 15, 2014 in Uncategorized

 

How to uninstall HP Utility on a MAC

Got a new Espon printer after my HP dies, but I can’t seem to remove the HP Utility in my LaunchPad… Took a while for me to figure out. (Most of the links I Googled suck.)

Just because HP sucks and it hides its HP Utility app somewhere, doesn’t mean you cannot install the redundant program.

  1. Remove your printer.
    1. Go to “Printers and Scanners”. (I did a quick spotlight search. You can go there through System Preference.)
      pic1
    2. Select your old HP printer and then hit the ‘-‘ sign.
      pic2
  2. Remove the HP folder.
    1. The path is “/Library/Printers/hp”.
      pic3
    2. If you can’t find it, just go to your document. Then from the bottom select “Macintosh HD”. You should be able to navigate your way to the folder.
    3. Move it to Trash.
  3. Remove the gz files in PPDs folder.
    1. The path is “/Library/Printers/PPDs/Contents/Resources”.
      pic4
    2. Delete only the gz files relative to your deleted printer.
  4. Try to look for other HP files in your Library.
    1. I found a few files in Image Capture folder. I believe this  is depending on your printer model.
  5. Delete shortcut in LaunchPad (Applications) folder.
    1. In Finder, open Applications folder.
    2. Under Utilities, you will see the shortcut link to HP Utility.
    3. Delete that too.
  6. Empty Trash.
  7. Run Disk Utility (spotlight search it or find it under Utility in launch pad).
    1. Select Macintost HD
    2. Click on Verify Disk Permission.
    3. When it’s done, click on Repair Disk Permission.
      pic5
  8. Restart your Mac

Now you are done!

 
4 Comments

Posted by on October 29, 2013 in Uncategorized

 

Tags: , , ,

Beautiful Arizona

I miss sunshine. Phoenix is just so beautiful. Probably gonna visit again in June before work starts.

 
Leave a comment

Posted by on April 18, 2013 in Uncategorized

 

Tags: , , , , , ,

Brunch with Yolanda at Sunshine Diner

Yolanda with her Hello Kitty Phone Case

Went to The Sunshine Diner with Yolanda this morning for brunch. -> This place <- Food is pretty nice~ I really like the BC Benny, but the fries is a bit cold. Yolanda didn’t really like the Omelette, but I tried it. I think it’s ok too.Hot Chocolate is average. I will definitely go again, just to try the other Bennies.

My Hot Chocolate

Half Order Benny with Home Fries

Yolanda’s Order – Mushroom and Bacon Omelette with Brown Toast

 
Leave a comment

Posted by on September 7, 2012 in Uncategorized

 

Pichu from Adrian

image

I am a Pichu collector… People who are travelling to Japan, (yes, I am implying you, Crystal) buy me more Pichu… Please……….

 
4 Comments

Posted by on April 5, 2012 in Uncategorized

 

*9.1+30/-275468

If you have a 0123456789+-*/ number pad? Ever try to click on those keys at the same time? If you click two buttons at once, you will probably get your “key combo” in this order “*9.1+30/-275468″…

ie, if you click “1”, “2” and “3” at once, you will get “132”, if you click “4”, “5” and “6” at once, you will get “546”, and if you click “7”, “8” and “9” at once, you will get “978”.

I guess this is because of the “sensor” under the keyboard response this way (or the PCB circuit/microcontroller-button response time)… oh well, this is how bore I am at work… I am so bored, I actually play with my keyboard. Back to software testing now!

 
2 Comments

Posted by on March 28, 2012 in Uncategorized