diff --git a/java/res/xml-sw600dp/kbd_thai.xml b/java/res/xml-sw600dp/kbd_thai.xml
deleted file mode 100644
index b4a4a0b925d839ce0f45a3c244ac84135438c705..0000000000000000000000000000000000000000
--- a/java/res/xml-sw600dp/kbd_thai.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<Keyboard
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-    latin:rowHeight="20%p"
-    latin:verticalGap="@fraction/key_bottom_gap_5row"
-    latin:keyLetterSize="@fraction/key_letter_ratio_5row"
-    latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5row"
-    latin:touchPositionCorrectionData="@null"
->
-    <include
-        latin:keyboardLayout="@xml/rows_thai" />
-</Keyboard>
diff --git a/java/res/xml-sw600dp/rowkeys_thai1.xml b/java/res/xml-sw600dp/rowkeys_thai1.xml
deleted file mode 100644
index 842bf05eea8d67b4db3cfcd2be713a27a5d4c2b1..0000000000000000000000000000000000000000
--- a/java/res/xml-sw600dp/rowkeys_thai1.xml
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<merge
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
->
-    <switch>
-        <case
-            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
-        >
-            <!-- U+0E51: "๑" THAI DIGIT ONE -->
-            <Key
-                latin:keyLabel="&#x0E51;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E52: "๒" THAI DIGIT TWO -->
-            <Key
-                latin:keyLabel="&#x0E52;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E53: "๓" THAI DIGIT THREE -->
-            <Key
-                latin:keyLabel="&#x0E53;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E54: "๔" THAI DIGIT FOUR -->
-            <Key
-                latin:keyLabel="&#x0E54;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0020: " " SPACE
-                 U+0E39: " ู" THAI CHARACTER SARA UU -->
-            <!-- Note: The space character is needed as a preceding letter to draw some Thai
-                 composing characters correctly. -->
-            <Key
-                latin:keyLabel="&#x20;&#x0E39;"
-                latin:code="0x0E39"
-                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
-            <!-- U+0E3F: "฿" THAI CURRENCY SYMBOL BAHT -->
-            <Key
-                latin:keyLabel="&#x0E3F;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E55: "๕" THAI DIGIT FIVE -->
-            <Key
-                latin:keyLabel="&#x0E55;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E56: "๖" THAI DIGIT SIX -->
-            <Key
-                latin:keyLabel="&#x0E56;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E57: "๗" THAI DIGIT SEVEN -->
-            <Key
-                latin:keyLabel="&#x0E57;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E58: "๘" THAI DIGIT EIGHT -->
-            <Key
-                latin:keyLabel="&#x0E58;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E59: "๙" THAI DIGIT NINE -->
-            <Key
-                latin:keyLabel="&#x0E59;"
-                latin:keyLabelFlags="fontNormal" />
-        </case>
-        <default>
-            <!-- U+0E45: "ๅ" THAI CHARACTER LAKKHANGYAO -->
-            <Key
-                latin:keyLabel="&#x0E45;"
-                latin:keyLabelFlags="fontNormal" />
-            <Key
-                latin:keyLabel="/" />
-            <!-- U+0E20: "ภ" THAI CHARACTER PHO SAMPHAO -->
-            <Key
-                latin:keyLabel="&#x0E20;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E16: "ถ" THAI CHARACTER THO THUNG -->
-            <Key
-                latin:keyLabel="&#x0E16;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0020: " " SPACE
-                 U+0E38: " ุ" THAI CHARACTER SARA U -->
-            <!-- Note: The space character is needed as a preceding letter to draw some Thai
-                 composing characters correctly. -->
-            <Key
-                latin:keyLabel="&#x20;&#x0E38;"
-                latin:code="0x0E38"
-                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
-            <!-- U+0020: " " SPACE
-                 U+0E36: " ึ" THAI CHARACTER SARA UE -->
-            <!-- Note: The space character is needed as a preceding letter to draw some Thai
-                 composing characters correctly. -->
-            <Key
-                latin:keyLabel="&#x20;&#x0E36;"
-                latin:code="0x0E36"
-                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
-            <!-- U+0E04: "ค" THAI CHARACTER KHO KHWAI -->
-            <Key
-                latin:keyLabel="&#x0E04;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E15: "ต" THAI CHARACTER TO TAO -->
-            <Key
-                latin:keyLabel="&#x0E15;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E08: "จ" THAI CHARACTER CHO CHAN -->
-            <Key
-                latin:keyLabel="&#x0E08;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E02: "ข" THAI CHARACTER KHO KHAI -->
-            <Key
-                latin:keyLabel="&#x0E02;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E0A: "ช" THAI CHARACTER CHO CHANG -->
-            <Key
-                latin:keyLabel="&#x0E0A;"
-                latin:keyLabelFlags="fontNormal" />
-        </default>
-    </switch>
-</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_thai2.xml b/java/res/xml-sw600dp/rowkeys_thai2.xml
deleted file mode 100644
index 71ab2c9dff8121e8e9ad9eeaed0f3a79210464fd..0000000000000000000000000000000000000000
--- a/java/res/xml-sw600dp/rowkeys_thai2.xml
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<merge
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
->
-    <switch>
-        <case
-            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
-        >
-            <!-- U+0E50: "๐" THAI DIGIT ZERO -->
-            <Key
-                latin:keyLabel="&#x0E50;"
-                latin:keyLabelFlags="fontNormal" />
-            <Key
-                latin:keyLabel="&quot;" />
-            <!-- U+0E0E: "ฎ" THAI CHARACTER DO CHADA -->
-            <Key
-                latin:keyLabel="&#x0E0E;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E11: "ฑ" THAI CHARACTER THO NANGMONTHO -->
-            <Key
-                latin:keyLabel="&#x0E11;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E18: "ธ" THAI CHARACTER THO THONG -->
-            <Key
-                latin:keyLabel="&#x0E18;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0020: " " SPACE
-                 U+0E4D: " ํ" THAI CHARACTER THANTHAKHAT -->
-            <!-- Note: The space character is needed as a preceding letter to draw some Thai
-                 composing characters correctly. -->
-            <Key
-                latin:keyLabel="&#x20;&#x0E4D;"
-                latin:code="0x0E4D"
-                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
-            <!-- U+0020: " " SPACE
-                 U+0E4A: " ๊" THAI CHARACTER MAI TRI -->
-            <!-- Note: The space character is needed as a preceding letter to draw some Thai
-                 composing characters correctly. -->
-            <Key
-                latin:keyLabel="&#x20;&#x0E4A;"
-                latin:code="0x0E4A"
-                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
-            <!-- U+0E13: "ณ" THAI CHARACTER NO NEN -->
-            <Key
-                latin:keyLabel="&#x0E13;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E2F: "ฯ" THAI CHARACTER PAIYANNOI -->
-            <Key
-                latin:keyLabel="&#x0E2F;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E0D: "ญ" THAI CHARACTER YO YING -->
-            <Key
-                latin:keyLabel="&#x0E0D;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E10: "ฐ" THAI CHARACTER THO THAN -->
-            <Key
-                latin:keyLabel="&#x0E10;"
-                latin:keyLabelFlags="fontNormal" />
-            <Key
-                latin:keyLabel="," />
-            <!-- U+0E05: "ฅ" THAI CHARACTER KHO KHON -->
-            <Key
-                latin:keyLabel="&#x0E05;"
-                latin:keyLabelFlags="fontNormal" />
-        </case>
-        <default>
-            <!-- U+0E46: "ๆ" THAI CHARACTER MAIYAMOK -->
-            <Key
-                latin:keyLabel="&#x0E46;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E44: "ไ" THAI CHARACTER SARA AI MAIMALAI -->
-            <Key
-                latin:keyLabel="&#x0E44;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E33: "ำ" THAI CHARACTER SARA AM -->
-            <Key
-                latin:keyLabel="&#x0E33;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E1E: "พ" THAI CHARACTER PHO PHAN -->
-            <Key
-                latin:keyLabel="&#x0E1E;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E30: "ะ" THAI CHARACTER SARA A -->
-            <Key
-                latin:keyLabel="&#x0E30;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0020: " " SPACE
-                 U+0E31: " ั" THAI CHARACTER MAI HAN-AKAT -->
-            <!-- Note: The space character is needed as a preceding letter to draw some Thai
-                 composing characters correctly. -->
-            <Key
-                latin:keyLabel="&#x20;&#x0E31;"
-                latin:code="0x0E31"
-                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
-            <!-- U+0020: " " SPACE
-                 U+0E35: " ี" HAI CHARACTER SARA II -->
-            <!-- Note: The space character is needed as a preceding letter to draw some Thai
-                 composing characters correctly. -->
-            <Key
-                latin:keyLabel="&#x20;&#x0E35;"
-                latin:code="0x0E35"
-                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
-            <!-- U+0E23: "ร" THAI CHARACTER RO RUA -->
-            <Key
-                latin:keyLabel="&#x0E23;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E19: "น" THAI CHARACTER NO NU -->
-            <Key
-                latin:keyLabel="&#x0E19;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E22: "ย" THAI CHARACTER YO YAK -->
-            <Key
-                latin:keyLabel="&#x0E22;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E1A: "บ" THAI CHARACTER BO BAIMAI -->
-            <Key
-                latin:keyLabel="&#x0E1A;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E25: "ล" THAI CHARACTER LO LING -->
-            <Key
-                latin:keyLabel="&#x0E25;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E03: "ฃ" THAI CHARACTER KHO KHUAT -->
-            <Key
-                latin:keyLabel="&#x0E03;"
-                latin:keyLabelFlags="fontNormal" />
-        </default>
-    </switch>
-</merge>
diff --git a/java/res/xml-sw600dp/rowkeys_thai3.xml b/java/res/xml-sw600dp/rowkeys_thai3.xml
deleted file mode 100644
index b9d1475ab0589715eafb4a22db10c79194adb07d..0000000000000000000000000000000000000000
--- a/java/res/xml-sw600dp/rowkeys_thai3.xml
+++ /dev/null
@@ -1,134 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<merge
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
->
-    <switch>
-        <case
-            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
-        >
-            <!-- U+0E24: "ฤ" THAI CHARACTER RU -->
-            <Key
-                latin:keyLabel="&#x0E24;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E06: "ฆ" THAI CHARACTER KHO RAKHANG -->
-            <Key
-                latin:keyLabel="&#x0E06;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E0F: "ฏ" THAI CHARACTER TO PATAK -->
-            <Key
-                latin:keyLabel="&#x0E0F;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E42: "โ" THAI CHARACTER SARA O -->
-            <Key
-                latin:keyLabel="&#x0E42;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E0C: "ฌ" THAI CHARACTER CHO CHOE -->
-            <Key
-                latin:keyLabel="&#x0E0C;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0020: " " SPACE
-                 U+0E47: " ็" THAI CHARACTER MAITAIKHU -->
-            <!-- Note: The space character is needed as a preceding letter to draw some Thai
-                 composing characters correctly. -->
-            <Key
-                latin:keyLabel="&#x20;&#x0E47;"
-                latin:code="0x0E47"
-                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
-            <!-- U+0020: " " SPACE
-                 U+0E4B: " ๋" THAI CHARACTER MAI CHATTAWA -->
-            <!-- Note: The space character is needed as a preceding letter to draw some Thai
-                 composing characters correctly. -->
-            <Key
-                latin:keyLabel="&#x20;&#x0E4B;"
-                latin:code="0x0E4B"
-                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
-            <!-- U+0E29: "ษ" THAI CHARACTER SO RUSI -->
-            <Key
-                latin:keyLabel="&#x0E29;"
-                latin:keyLabelFlags="fontNormal" />
-            <!--  U+0E28: "ศ" THAI CHARACTER SO SALA -->
-            <Key
-                latin:keyLabel="&#x0E28;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E0B: "ซ" THAI CHARACTER SO SO -->
-            <Key
-                latin:keyLabel="&#x0E0B;"
-                latin:keyLabelFlags="fontNormal" />
-            <Key
-                latin:keyLabel="." />
-        </case>
-        <default>
-            <!-- U+0E1F: "ฟ" THAI CHARACTER FO FAN -->
-            <Key
-                latin:keyLabel="&#x0E1F;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E2B: "ห" THAI CHARACTER HO HIP -->
-            <Key
-                latin:keyLabel="&#x0E2B;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E01: "ก" THAI CHARACTER KO KAI -->
-            <Key
-                latin:keyLabel="&#x0E01;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E14: "ด" THAI CHARACTER DO DEK -->
-            <Key
-                latin:keyLabel="&#x0E14;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E40: "เ" THAI CHARACTER SARA E -->
-            <Key
-                latin:keyLabel="&#x0E40;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0020: " " SPACE
-                 U+0E49: " ้" THAI CHARACTER MAI THO -->
-            <!-- Note: The space character is needed as a preceding letter to draw some Thai
-                 composing characters correctly. -->
-            <Key
-                latin:keyLabel="&#x20;&#x0E49;"
-                latin:code="0x0E49"
-                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
-            <!-- U+0020: " " SPACE
-                 U+0E48: " ฺ" THAI CHARACTER MAI EK -->
-            <!-- Note: The space character is needed as a preceding letter to draw some Thai
-                 composing characters correctly. -->
-            <Key
-                latin:keyLabel="&#x20;&#x0E48;"
-                latin:code="0x0E48"
-                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
-            <!-- U+0E32: "า" THAI CHARACTER SARA AA -->
-            <Key
-                latin:keyLabel="&#x0E32;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E2A: "ส" THAI CHARACTER SO SUA -->
-            <Key
-                latin:keyLabel="&#x0E2A;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E27: "ว" THAI CHARACTER WO WAEN -->
-            <Key
-                latin:keyLabel="&#x0E27;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E07: "ง" THAI CHARACTER NGO NGU -->
-            <Key
-                latin:keyLabel="&#x0E07;"
-                latin:keyLabelFlags="fontNormal" />
-        </default>
-    </switch>
-</merge>
diff --git a/java/res/xml-sw600dp/rows_thai.xml b/java/res/xml-sw600dp/rows_thai.xml
index c1fe55b39e052304312a0c5a66a12c7a42ee3948..bc89640acaab2a0caf2746b21617da181c294fcc 100644
--- a/java/res/xml-sw600dp/rows_thai.xml
+++ b/java/res/xml-sw600dp/rows_thai.xml
@@ -27,8 +27,7 @@
         latin:keyWidth="7.5%p"
     >
         <include
-            latin:keyboardLayout="@xml/rowkeys_thai1"
-            latin:keyXPos="3.75%p" />
+            latin:keyboardLayout="@xml/rowkeys_thai1" />
         <Key
             latin:keyStyle="deleteKeyStyle"
             latin:keyWidth="fillRight" />
@@ -38,14 +37,16 @@
     >
         <include
             latin:keyboardLayout="@xml/rowkeys_thai2"
-            latin:keyXPos="0.719%p" />
+            latin:keyXPos="2.5%p" />
+        <include
+            latin:keyboardLayout="@xml/key_thai_kho_khuat" />
     </Row>
     <Row
         latin:keyWidth="7.5%p"
     >
         <include
             latin:keyboardLayout="@xml/rowkeys_thai3"
-            latin:keyXPos="3.75%p" />
+            latin:keyXPos="5.0%p" />
         <Key
             latin:keyStyle="enterKeyStyle"
             latin:keyWidth="fillRight" />
diff --git a/java/res/xml-sw768dp-land/kbd_thai.xml b/java/res/xml-sw768dp-land/kbd_thai.xml
deleted file mode 100644
index b4a4a0b925d839ce0f45a3c244ac84135438c705..0000000000000000000000000000000000000000
--- a/java/res/xml-sw768dp-land/kbd_thai.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<Keyboard
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-    latin:rowHeight="20%p"
-    latin:verticalGap="@fraction/key_bottom_gap_5row"
-    latin:keyLetterSize="@fraction/key_letter_ratio_5row"
-    latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5row"
-    latin:touchPositionCorrectionData="@null"
->
-    <include
-        latin:keyboardLayout="@xml/rows_thai" />
-</Keyboard>
diff --git a/java/res/xml-sw768dp-land/kbd_thai_symbols.xml b/java/res/xml-sw768dp-land/kbd_thai_symbols.xml
deleted file mode 100644
index 0cd9a61ea861e872446d96965adb021764fb570e..0000000000000000000000000000000000000000
--- a/java/res/xml-sw768dp-land/kbd_thai_symbols.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<Keyboard
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-    latin:rowHeight="20%p"
-    latin:verticalGap="@fraction/key_bottom_gap_5row"
-    latin:keyLetterSize="@fraction/key_letter_ratio_5row"
-    latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5row"
-    latin:touchPositionCorrectionData="@null"
->
-    <include
-        latin:keyboardLayout="@xml/rows_thai_symbols" />
-</Keyboard>
diff --git a/java/res/xml-sw768dp-land/kbd_thai_symbols_shift.xml b/java/res/xml-sw768dp-land/kbd_thai_symbols_shift.xml
deleted file mode 100644
index a68fec458bc0eb041324e59b81857730e7e4c61a..0000000000000000000000000000000000000000
--- a/java/res/xml-sw768dp-land/kbd_thai_symbols_shift.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<Keyboard
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-    latin:rowHeight="20%p"
-    latin:verticalGap="@fraction/key_bottom_gap_5row"
-    latin:keyLetterSize="@fraction/key_letter_ratio_5row"
-    latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5row"
-    latin:touchPositionCorrectionData="@null"
->
-    <include
-        latin:keyboardLayout="@xml/rows_thai_symbols_shift" />
-</Keyboard>
diff --git a/java/res/xml-sw768dp/kbd_thai.xml b/java/res/xml-sw768dp/kbd_thai.xml
deleted file mode 100644
index b4a4a0b925d839ce0f45a3c244ac84135438c705..0000000000000000000000000000000000000000
--- a/java/res/xml-sw768dp/kbd_thai.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2012, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-
-<Keyboard
-    xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-    latin:rowHeight="20%p"
-    latin:verticalGap="@fraction/key_bottom_gap_5row"
-    latin:keyLetterSize="@fraction/key_letter_ratio_5row"
-    latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5row"
-    latin:touchPositionCorrectionData="@null"
->
-    <include
-        latin:keyboardLayout="@xml/rows_thai" />
-</Keyboard>
diff --git a/java/res/xml-sw768dp/rows_thai.xml b/java/res/xml-sw768dp/rows_thai.xml
index 7721bc5a93a9a207919256dec9b66b209dd3022c..5f9b383f83a6267d59ed0e4443a9d218c05c9d4f 100644
--- a/java/res/xml-sw768dp/rows_thai.xml
+++ b/java/res/xml-sw768dp/rows_thai.xml
@@ -28,7 +28,7 @@
     >
         <include
             latin:keyboardLayout="@xml/rowkeys_thai1"
-            latin:keyXPos="11.508%p" />
+            latin:keyXPos="3.799%p" />
         <Key
             latin:keyStyle="deleteKeyStyle"
             latin:keyWidth="fillRight"/>
@@ -42,9 +42,11 @@
             latin:keyWidth="7.969%p" />
         <include
             latin:keyboardLayout="@xml/rowkeys_thai2" />
+        <include
+            latin:keyboardLayout="@xml/key_thai_kho_khuat" />
     </Row>
     <Row
-        latin:keyWidth="7.125%p"
+        latin:keyWidth="7.079%p"
     >
         <Key
             latin:keyStyle="toSymbolKeyStyle"
diff --git a/java/res/xml/kbd_thai.xml b/java/res/xml/kbd_thai.xml
index 058ca16a3ee7d5079e97caa36db2101d467d998c..b4a4a0b925d839ce0f45a3c244ac84135438c705 100644
--- a/java/res/xml/kbd_thai.xml
+++ b/java/res/xml/kbd_thai.xml
@@ -20,6 +20,11 @@
 
 <Keyboard
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
+    latin:rowHeight="20%p"
+    latin:verticalGap="@fraction/key_bottom_gap_5row"
+    latin:keyLetterSize="@fraction/key_letter_ratio_5row"
+    latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5row"
+    latin:touchPositionCorrectionData="@null"
 >
     <include
         latin:keyboardLayout="@xml/rows_thai" />
diff --git a/java/res/xml-sw600dp-land/kbd_thai.xml b/java/res/xml/key_thai_kho_khuat.xml
similarity index 56%
rename from java/res/xml-sw600dp-land/kbd_thai.xml
rename to java/res/xml/key_thai_kho_khuat.xml
index b4a4a0b925d839ce0f45a3c244ac84135438c705..0ffd0f9249c4cb1de7981f862eff04a9607455b6 100644
--- a/java/res/xml-sw600dp-land/kbd_thai.xml
+++ b/java/res/xml/key_thai_kho_khuat.xml
@@ -18,14 +18,23 @@
 */
 -->
 
-<Keyboard
+<merge
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-    latin:rowHeight="20%p"
-    latin:verticalGap="@fraction/key_bottom_gap_5row"
-    latin:keyLetterSize="@fraction/key_letter_ratio_5row"
-    latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5row"
-    latin:touchPositionCorrectionData="@null"
 >
-    <include
-        latin:keyboardLayout="@xml/rows_thai" />
-</Keyboard>
+    <switch>
+        <case
+            latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
+        >
+            <!-- U+0E05: "ฅ" THAI CHARACTER KHO KHON -->
+            <Key
+                latin:keyLabel="&#x0E05;"
+                latin:keyLabelFlags="fontNormal" />
+        </case>
+        <default>
+            <!-- U+0E03: "ฃ" THAI CHARACTER KHO KHUAT -->
+            <Key
+                latin:keyLabel="&#x0E03;"
+                latin:keyLabelFlags="fontNormal" />
+        </default>
+    </switch>
+</merge>
diff --git a/java/res/xml/rowkeys_thai1.xml b/java/res/xml/rowkeys_thai1.xml
index e175befb3b1bbf6a8487f494999c09395056e8e2..950d2a45698d8a4d2a63faa9b77f7985e9d47215 100644
--- a/java/res/xml/rowkeys_thai1.xml
+++ b/java/res/xml/rowkeys_thai1.xml
@@ -25,119 +25,109 @@
         <case
             latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
-            <!-- U+0E0E: "ฎ" THAI CHARACTER DO CHADA -->
             <Key
-                latin:keyLabel="&#x0E0E;"
+                latin:keyLabel="+" />
+            <!-- U+0E51: "๑" THAI DIGIT ONE -->
+            <Key
+                latin:keyLabel="&#x0E51;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E11: "ฑ" THAI CHARACTER THO NANGMONTHO -->
+            <!-- U+0E52: "๒" THAI DIGIT TWO -->
             <Key
-                latin:keyLabel="&#x0E11;"
+                latin:keyLabel="&#x0E52;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E18: "ธ" THAI CHARACTER THO THONG -->
+            <!-- U+0E53: "๓" THAI DIGIT THREE -->
             <Key
-                latin:keyLabel="&#x0E18;"
+                latin:keyLabel="&#x0E53;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E13: "ณ" THAI CHARACTER NO NEN -->
+            <!-- U+0E54: "๔" THAI DIGIT FOUR -->
             <Key
-                latin:keyLabel="&#x0E13;"
+                latin:keyLabel="&#x0E54;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E0D: "ญ" THAI CHARACTER YO YING -->
+            <!-- U+0020: " " SPACE
+                 U+0E39: " ู" THAI CHARACTER SARA UU -->
+            <!-- Note: The space character is needed as a preceding letter to draw some Thai
+                 composing characters correctly. -->
             <Key
-                latin:keyLabel="&#x0E0D;"
+                latin:keyLabel="&#x20;&#x0E39;"
+                latin:code="0x0E39"
+                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+            <!-- U+0E3F: "฿" THAI CURRENCY SYMBOL BAHT -->
+            <Key
+                latin:keyLabel="&#x0E3F;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E10: "ฐ" THAI CHARACTER THO THAN -->
+            <!-- U+0E55: "๕" THAI DIGIT FIVE -->
             <Key
-                latin:keyLabel="&#x0E10;"
+                latin:keyLabel="&#x0E55;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E03: "ฃ" THAI CHARACTER KHO KHUAT -->
+            <!-- U+0E56: "๖" THAI DIGIT SIX -->
             <Key
-                latin:keyLabel="&#x0E03;"
+                latin:keyLabel="&#x0E56;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E05: "ฅ" THAI CHARACTER KHO KHON -->
+            <!-- U+0E57: "๗" THAI DIGIT SEVEN -->
             <Key
-                latin:keyLabel="&#x0E05;"
+                latin:keyLabel="&#x0E57;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E51: "๑" THAI DIGIT ONE
-                 U+0E52: "๒" THAI DIGIT TWO
-                 U+0E53: "๓" THAI DIGIT THREE
-                 U+0E54: "๔" THAI DIGIT FOUR
-                 U+0E55: "๕" THAI DIGIT FIVE -->
+            <!-- U+0E58: "๘" THAI DIGIT EIGHT -->
             <Key
-                latin:keyLabel="&#x0E51;"
-                latin:moreKeys="!fixedColumnOrder!4,&#x0E52;,&#x0E53;,&#x0E54;,&#x0E55;"
+                latin:keyLabel="&#x0E58;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E56: "๖" THAI DIGIT SIX
-                 U+0E57: "๗" THAI DIGIT SEVEN
-                 U+0E58: "๘" THAI DIGIT EIGHT
-                 U+0E59: "๙" THAI DIGIT NINE
-                 U+0E50: "๐" THAI DIGIT ZERO -->
+            <!-- U+0E59: "๙" THAI DIGIT NINE -->
             <Key
-                latin:keyLabel="&#x0E56;"
-                latin:moreKeys="!fixedColumnOrder!4,&#x0E57;,&#x0E58;,&#x0E59;,&#x0E50;"
+                latin:keyLabel="&#x0E59;"
                 latin:keyLabelFlags="fontNormal" />
         </case>
         <default>
+            <!-- U+0E45: "ๅ" THAI CHARACTER LAKKHANGYAO -->
+            <Key
+                latin:keyLabel="&#x0E45;"
+                latin:keyLabelFlags="fontNormal" />
+            <Key
+                latin:keyLabel="/" />
+            <Key
+                latin:keyLabel="_" />
             <!-- U+0E20: "ภ" THAI CHARACTER PHO SAMPHAO -->
             <Key
                 latin:keyLabel="&#x0E20;"
-                latin:keyHintLabel="1"
-                latin:additionalMoreKeys="1,&#x0E51;"
                 latin:keyLabelFlags="fontNormal" />
             <!-- U+0E16: "ถ" THAI CHARACTER THO THUNG -->
             <Key
                 latin:keyLabel="&#x0E16;"
-                latin:keyHintLabel="2"
-                latin:additionalMoreKeys="2,&#x0E52;"
                 latin:keyLabelFlags="fontNormal" />
+            <!-- U+0020: " " SPACE
+                 U+0E38: " ุ" THAI CHARACTER SARA U -->
+            <!-- Note: The space character is needed as a preceding letter to draw some Thai
+                 composing characters correctly. -->
+            <Key
+                latin:keyLabel="&#x20;&#x0E38;"
+                latin:code="0x0E38"
+                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+            <!-- U+0020: " " SPACE
+                 U+0E36: " ึ" THAI CHARACTER SARA UE -->
+            <!-- Note: The space character is needed as a preceding letter to draw some Thai
+                 composing characters correctly. -->
+            <Key
+                latin:keyLabel="&#x20;&#x0E36;"
+                latin:code="0x0E36"
+                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
             <!-- U+0E04: "ค" THAI CHARACTER KHO KHWAI -->
             <Key
                 latin:keyLabel="&#x0E04;"
-                latin:keyHintLabel="3"
-                latin:additionalMoreKeys="3,&#x0E53;"
                 latin:keyLabelFlags="fontNormal" />
             <!-- U+0E15: "ต" THAI CHARACTER TO TAO -->
             <Key
                 latin:keyLabel="&#x0E15;"
-                latin:keyHintLabel="4"
-                latin:additionalMoreKeys="4,&#x0E54;"
                 latin:keyLabelFlags="fontNormal" />
             <!-- U+0E08: "จ" THAI CHARACTER CHO CHAN -->
             <Key
                 latin:keyLabel="&#x0E08;"
-                latin:keyHintLabel="5"
-                latin:additionalMoreKeys="5,&#x0E55;"
                 latin:keyLabelFlags="fontNormal" />
             <!-- U+0E02: "ข" THAI CHARACTER KHO KHAI -->
             <Key
                 latin:keyLabel="&#x0E02;"
-                latin:keyHintLabel="6"
-                latin:additionalMoreKeys="6,&#x0E56;"
                 latin:keyLabelFlags="fontNormal" />
             <!-- U+0E0A: "ช" THAI CHARACTER CHO CHANG -->
             <Key
                 latin:keyLabel="&#x0E0A;"
-                latin:keyHintLabel="7"
-                latin:additionalMoreKeys="7,&#x0E57;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E23: "ร" THAI CHARACTER RO RUA
-                 U+0E25: "ล" THAI CHARACTER LO LING -->
-            <Key
-                latin:keyLabel="&#x0E23;"
-                latin:moreKeys="&#x0E25;"
-                latin:keyHintLabel="8"
-                latin:additionalMoreKeys="8,&#x0E58;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E19: "น" THAI CHARACTER NO NU -->
-            <Key
-                latin:keyLabel="&#x0E19;"
-                latin:keyHintLabel="9"
-                latin:additionalMoreKeys="9,&#x0E59;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E22: "ย" THAI CHARACTER YO YAK -->
-            <Key
-                latin:keyLabel="&#x0E22;"
-                latin:keyHintLabel="0"
-                latin:additionalMoreKeys="0,&#x0E50;"
                 latin:keyLabelFlags="fontNormal" />
         </default>
     </switch>
diff --git a/java/res/xml/rowkeys_thai2.xml b/java/res/xml/rowkeys_thai2.xml
index f5fd405e4cdb7d4ec1db7776d3c4049fb04c6501..f602994b985f06a686f82e3d4341ee9785c25ae4 100644
--- a/java/res/xml/rowkeys_thai2.xml
+++ b/java/res/xml/rowkeys_thai2.xml
@@ -25,105 +25,116 @@
         <case
             latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
-            <!-- U+0E24: "ฤ" THAI CHARACTER RU -->
+            <!-- U+0E50: "๐" THAI DIGIT ZERO -->
             <Key
-                latin:keyLabel="&#x0E24;"
+                latin:keyLabel="&#x0E50;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E06: "ฆ" THAI CHARACTER KHO RAKHANG -->
             <Key
-                latin:keyLabel="&#x0E06;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E0F: "ฏ" THAI CHARACTER TO PATAK -->
+                latin:keyLabel="&quot;" />
+            <!-- U+0E0E: "ฎ" THAI CHARACTER DO CHADA -->
             <Key
-                latin:keyLabel="&#x0E0F;"
+                latin:keyLabel="&#x0E0E;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E0C: "ฌ" THAI CHARACTER CHO CHOE -->
+            <!-- U+0E11: "ฑ" THAI CHARACTER THO NANGMONTHO -->
             <Key
-                latin:keyLabel="&#x0E0C;"
+                latin:keyLabel="&#x0E11;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E29: "ษ" THAI CHARACTER SO RUSI -->
+            <!-- U+0E18: "ธ" THAI CHARACTER THO THONG -->
             <Key
-                latin:keyLabel="&#x0E29;"
+                latin:keyLabel="&#x0E18;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E28: "ศ" THAI CHARACTER SO SALA -->
+            <!-- U+0020: " " SPACE
+                 U+0E4D: " ํ" THAI CHARACTER THANTHAKHAT -->
+            <!-- Note: The space character is needed as a preceding letter to draw some Thai
+                 composing characters correctly. -->
             <Key
-                latin:keyLabel="&#x0E28;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E0B: "ซ" THAI CHARACTER SO SO -->
+                latin:keyLabel="&#x20;&#x0E4D;"
+                latin:code="0x0E4D"
+                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+            <!-- U+0020: " " SPACE
+                 U+0E4A: " ๊" THAI CHARACTER MAI TRI -->
+            <!-- Note: The space character is needed as a preceding letter to draw some Thai
+                 composing characters correctly. -->
             <Key
-                latin:keyLabel="&#x0E0B;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E3F: "฿" THAI CURRENCY SYMBOL BAHT
-                 U+0E45: "ๅ" THAI CHARACTER LAKKHANGYAO -->
+                latin:keyLabel="&#x20;&#x0E4A;"
+                latin:code="0x0E4A"
+                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+            <!-- U+0E13: "ณ" THAI CHARACTER NO NEN -->
             <Key
-                latin:keyLabel="&#x0E3F;"
-                latin:moreKeys="&#x0E45;"
+                latin:keyLabel="&#x0E13;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E46: "ๆ" THAI CHARACTER MAIYAMOK
-                 U+0E2F: "ฯ" THAI CHARACTER PAIYANNOI -->
+            <!-- U+0E2F: "ฯ" THAI CHARACTER PAIYANNOI -->
             <Key
-                latin:keyLabel="&#x0E46;"
-                latin:moreKeys="&#x0E2F;"
+                latin:keyLabel="&#x0E2F;"
                 latin:keyLabelFlags="fontNormal" />
-        </case>
-        <default>
-            <!-- U+0E1F: "ฟ" THAI CHARACTER FO FAN
-                 U+0E1E: "พ" THAI CHARACTER PHO PHAN -->
+            <!-- U+0E0D: "ญ" THAI CHARACTER YO YING -->
             <Key
-                latin:keyLabel="&#x0E1F;"
-                latin:moreKeys="&#x0E1E;"
+                latin:keyLabel="&#x0E0D;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E2B: "ห" THAI CHARACTER HO HIP -->
+            <!-- U+0E10: "ฐ" THAI CHARACTER THO THAN -->
             <Key
-                latin:keyLabel="&#x0E2B;"
+                latin:keyLabel="&#x0E10;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E01: "ก" THAI CHARACTER KO KAI -->
             <Key
-                latin:keyLabel="&#x0E01;"
-                latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E14: "ด" THAI CHARACTER DO DEK -->
+                latin:keyLabel="," />
+        </case>
+        <default>
+            <!-- U+0E46: "ๆ" THAI CHARACTER MAIYAMOK -->
             <Key
-                latin:keyLabel="&#x0E14;"
+                latin:keyLabel="&#x0E46;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E2A: "ส" THAI CHARACTER SO SUA -->
+            <!-- U+0E44: "ไ" THAI CHARACTER SARA AI MAIMALAI -->
             <Key
-                latin:keyLabel="&#x0E2A;"
+                latin:keyLabel="&#x0E44;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E27: "ว" THAI CHARACTER WO WAEN -->
+            <!-- U+0E33: "ำ" THAI CHARACTER SARA AM -->
             <Key
-                latin:keyLabel="&#x0E27;"
+                latin:keyLabel="&#x0E33;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E07: "ง" THAI CHARACTER NGO NGU -->
+            <!-- U+0E1E: "พ" THAI CHARACTER PHO PHAN -->
             <Key
-                latin:keyLabel="&#x0E07;"
+                latin:keyLabel="&#x0E1E;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E30: "ะ" THAI CHARACTER SARA A
-                 U+0E32: "า" THAI CHARACTER SARA AA
-                 U+0E33: " ำ" THAI CHARACTER SARA AM
-                 U+0E40: "เ" THAI CHARACTER SARA E
-                 U+0E41: "แ" THAI CHARACTER SARA AE
-                 U+0E43: "ใ" THAI CHARACTER SARA AI MAIMUAN
-                 U+0E44: "ไ" THAI CHARACTER SARA AI MAIMALAI
-                 U+0E42: "โ" THAI CHARACTER SARA O -->
+            <!-- U+0E30: "ะ" THAI CHARACTER SARA A -->
             <Key
                 latin:keyLabel="&#x0E30;"
-                latin:moreKeys="&#x0E32;,&#x0E33;,&#x0E40;,&#x0E41;,&#x0E43;,&#x0E44;,&#x0E42;"
                 latin:keyLabelFlags="fontNormal" />
             <!-- U+0020: " " SPACE
-                 U+0E31: " ั" THAI CHARACTER MAI HAN-AKAT
-                 U+0E34: " ิ" THAI CHARACTER SARA I
-                 U+0E35: " ี" THAI CHARACTER SARA II
-                 U+0E36: " ึ" THAI CHARACTER SARA UE
-                 U+0E37: " ื" THAI CHARACTER SARA UEE
-                 U+0E38: " ุ" THAI CHARACTER SARA U
-                 U+0E39: " ู" THAI CHARACTER SARA UU -->
+                 U+0E31: " ั" THAI CHARACTER MAI HAN-AKAT -->
             <!-- Note: The space character is needed as a preceding letter to draw some Thai
                  composing characters correctly. -->
             <Key
                 latin:keyLabel="&#x20;&#x0E31;"
                 latin:code="0x0E31"
-                latin:moreKeys="&#x0E34;,&#x0E35;,&#x0E36;,&#x0E37;,&#x0E38;,&#x0E39;"
                 latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+            <!-- U+0020: " " SPACE
+                 U+0E35: " ี" HAI CHARACTER SARA II -->
+            <!-- Note: The space character is needed as a preceding letter to draw some Thai
+                 composing characters correctly. -->
+            <Key
+                latin:keyLabel="&#x20;&#x0E35;"
+                latin:code="0x0E35"
+                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+            <!-- U+0E23: "ร" THAI CHARACTER RO RUA -->
+            <Key
+                latin:keyLabel="&#x0E23;"
+                latin:keyLabelFlags="fontNormal" />
+            <!-- U+0E19: "น" THAI CHARACTER NO NU -->
+            <Key
+                latin:keyLabel="&#x0E19;"
+                latin:keyLabelFlags="fontNormal" />
+            <!-- U+0E22: "ย" THAI CHARACTER YO YAK -->
+            <Key
+                latin:keyLabel="&#x0E22;"
+                latin:keyLabelFlags="fontNormal" />
+            <!-- U+0E1A: "บ" THAI CHARACTER BO BAIMAI -->
+            <Key
+                latin:keyLabel="&#x0E1A;"
+                latin:keyLabelFlags="fontNormal" />
+            <!-- U+0E25: "ล" THAI CHARACTER LO LING -->
+            <Key
+                latin:keyLabel="&#x0E25;"
+                latin:keyLabelFlags="fontNormal" />
         </default>
     </switch>
 </merge>
diff --git a/java/res/xml/rowkeys_thai3.xml b/java/res/xml/rowkeys_thai3.xml
index 2fcc0068a7b9c32ccb6b22f0ea13cc71b6e554d6..7b6e6372eccf7f79f45bca977c171bdd1ea95c5c 100644
--- a/java/res/xml/rowkeys_thai3.xml
+++ b/java/res/xml/rowkeys_thai3.xml
@@ -25,85 +25,110 @@
         <case
             latin:keyboardLayoutSetElement="alphabetManualShifted|alphabetShiftLocked|alphabetShiftLockShifted"
         >
-            <!-- U+0E09: "ฉ" THAI CHARACTER CHO CHING -->
+            <!-- U+0E24: "ฤ" THAI CHARACTER RU -->
             <Key
-                latin:keyLabel="&#x0E09;"
+                latin:keyLabel="&#x0E24;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E2E: "ฮ" THAI CHARACTER HO NOKHUK -->
+            <!-- U+0E06: "ฆ" THAI CHARACTER KHO RAKHANG -->
             <Key
-                latin:keyLabel="&#x0E2E;"
+                latin:keyLabel="&#x0E06;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E12: "ฒ" THAI CHARACTER THO PHUTHAO -->
+            <!-- U+0E0F: "ฏ" THAI CHARACTER TO PATAK -->
             <Key
-                latin:keyLabel="&#x0E12;"
+                latin:keyLabel="&#x0E0F;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E2C: "ฬ" THAI CHARACTER LO CHULA -->
+            <!-- U+0E42: "โ" THAI CHARACTER SARA O -->
             <Key
-                latin:keyLabel="&#x0E2C;"
+                latin:keyLabel="&#x0E42;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E26: "ฦ" THAI CHARACTER LU -->
+            <!-- U+0E0C: "ฌ" THAI CHARACTER CHO CHOE -->
             <Key
-                latin:keyLabel="&#x0E26;"
+                latin:keyLabel="&#x0E0C;"
                 latin:keyLabelFlags="fontNormal" />
             <!-- U+0020: " " SPACE
-                 U+0E4C: " ์" THAI CHARACTER THANTHAKHAT
-                 U+0E4D: " ํ" THAI CHARACTER NIKHAHIT
-                 U+0E3A: " ฺ" THAI CHARACTER PHINTHU -->
+                 U+0E47: " ็" THAI CHARACTER MAITAIKHU -->
             <!-- Note: The space character is needed as a preceding letter to draw some Thai
                  composing characters correctly. -->
             <Key
-                latin:keyLabel="&#x20;&#x0E4C;"
-                latin:code="0x0E4C"
-                latin:moreKeys="&#x0E4D;,&#x0E3A;"
+                latin:keyLabel="&#x20;&#x0E47;"
+                latin:code="0x0E47"
                 latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
             <!-- U+0020: " " SPACE
-                 U+0E47: " ็" THAI CHARACTER MAITAIKHU -->
+                 U+0E4B: " ๋" THAI CHARACTER MAI CHATTAWA -->
             <!-- Note: The space character is needed as a preceding letter to draw some Thai
                  composing characters correctly. -->
             <Key
-                latin:keyLabel="&#x20;&#x0E47;"
-                latin:code="0x0E47"
+                latin:keyLabel="&#x20;&#x0E4B;"
+                latin:code="0x0E4B"
                 latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+            <!-- U+0E29: "ษ" THAI CHARACTER SO RUSI -->
+            <Key
+                latin:keyLabel="&#x0E29;"
+                latin:keyLabelFlags="fontNormal" />
+            <!--  U+0E28: "ศ" THAI CHARACTER SO SALA -->
+            <Key
+                latin:keyLabel="&#x0E28;"
+                latin:keyLabelFlags="fontNormal" />
+            <!-- U+0E0B: "ซ" THAI CHARACTER SO SO -->
+            <Key
+                latin:keyLabel="&#x0E0B;"
+                latin:keyLabelFlags="fontNormal" />
+            <Key
+                latin:keyLabel="." />
         </case>
         <default>
-            <!-- U+0E1C: "ผ" THAI CHARACTER PHO PHUNG -->
+            <!-- U+0E1F: "ฟ" THAI CHARACTER FO FAN -->
             <Key
-                latin:keyLabel="&#x0E1C;"
+                latin:keyLabel="&#x0E1F;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E1B: "ป" THAI CHARACTER PO PLA
-                 U+0E1A: "บ" THAI CHARACTER BO BAIMAI -->
+            <!-- U+0E2B: "ห" THAI CHARACTER HO HIP -->
             <Key
-                latin:keyLabel="&#x0E1B;"
-                latin:moreKeys="&#x0E1A;"
+                latin:keyLabel="&#x0E2B;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E2D: "อ" THAI CHARACTER O ANG -->
+            <!-- U+0E01: "ก" THAI CHARACTER KO KAI -->
             <Key
-                latin:keyLabel="&#x0E2D;"
+                latin:keyLabel="&#x0E01;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E17: "ท" THAI CHARACTER THO THAHAN -->
+            <!-- U+0E14: "ด" THAI CHARACTER DO DEK -->
             <Key
-                latin:keyLabel="&#x0E17;"
+                latin:keyLabel="&#x0E14;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E21: "ม" THAI CHARACTER MO MA -->
+            <!-- U+0E40: "เ" THAI CHARACTER SARA E -->
             <Key
-                latin:keyLabel="&#x0E21;"
+                latin:keyLabel="&#x0E40;"
                 latin:keyLabelFlags="fontNormal" />
-            <!-- U+0E1D: "ฝ" THAI CHARACTER FO FA -->
+            <!-- U+0020: " " SPACE
+                 U+0E49: " ้" THAI CHARACTER MAI THO -->
+            <!-- Note: The space character is needed as a preceding letter to draw some Thai
+                 composing characters correctly. -->
             <Key
-                latin:keyLabel="&#x0E1D;"
-                latin:keyLabelFlags="fontNormal" />
+                latin:keyLabel="&#x20;&#x0E49;"
+                latin:code="0x0E49"
+                latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
             <!-- U+0020: " " SPACE
-                 U+0E48: " ่" THAI CHARACTER MAI EK
-                 U+0E49: " ้" THAI CHARACTER MAI THO
-                 U+0E4A: " ๊" THAI CHARACTER MAI TRI
-                 U+0E4B: " ๋" THAI CHARACTER MAI CHATTAWA -->
+                 U+0E48: " ่" THAI CHARACTER MAI EK -->
             <!-- Note: The space character is needed as a preceding letter to draw some Thai
                  composing characters correctly. -->
             <Key
                 latin:keyLabel="&#x20;&#x0E48;"
                 latin:code="0x0E48"
-                latin:moreKeys="&#x0E49;,&#x0E4A;,&#x0E4B;"
                 latin:keyLabelFlags="fontNormal|followKeyLetterRatio" />
+            <!-- U+0E32: "า" THAI CHARACTER SARA AA -->
+            <Key
+                latin:keyLabel="&#x0E32;"
+                latin:keyLabelFlags="fontNormal" />
+            <!-- U+0E2A: "ส" THAI CHARACTER SO SUA -->
+            <Key
+                latin:keyLabel="&#x0E2A;"
+                latin:keyLabelFlags="fontNormal" />
+            <!-- U+0E27: "ว" THAI CHARACTER WO WAEN -->
+            <Key
+                latin:keyLabel="&#x0E27;"
+                latin:keyLabelFlags="fontNormal" />
+            <!-- U+0E07: "ง" THAI CHARACTER NGO NGU -->
+            <Key
+                latin:keyLabel="&#x0E07;"
+                latin:keyLabelFlags="fontNormal" />
         </default>
     </switch>
 </merge>
diff --git a/java/res/xml-sw600dp/rowkeys_thai4.xml b/java/res/xml/rowkeys_thai4.xml
similarity index 100%
rename from java/res/xml-sw600dp/rowkeys_thai4.xml
rename to java/res/xml/rowkeys_thai4.xml
diff --git a/java/res/xml/rows_thai.xml b/java/res/xml/rows_thai.xml
index 6b80df640052f2a4fcfd5027c23071634891fcb8..108b7e1fc935e38916b62671911d82d5e8d0d248 100644
--- a/java/res/xml/rows_thai.xml
+++ b/java/res/xml/rows_thai.xml
@@ -24,31 +24,34 @@
     <include
         latin:keyboardLayout="@xml/key_styles_common" />
     <Row
-        latin:keyWidth="10%p"
+        latin:keyWidth="8.3333%p"
     >
         <include
             latin:keyboardLayout="@xml/rowkeys_thai1" />
     </Row>
     <Row
-        latin:keyWidth="10%p"
+        latin:keyWidth="8.3333%p"
     >
         <include
-            latin:keyboardLayout="@xml/rowkeys_thai2"
-            latin:keyXPos="5%p" />
+            latin:keyboardLayout="@xml/rowkeys_thai2" />
     </Row>
     <Row
-        latin:keyWidth="10%p"
+        latin:keyWidth="8.3333%p"
     >
-        <Key
-            latin:keyStyle="shiftKeyStyle"
-            latin:keyWidth="15%p"
-            latin:visualInsetsRight="1%p" />
         <include
             latin:keyboardLayout="@xml/rowkeys_thai3" />
+        <include
+            latin:keyboardLayout="@xml/key_thai_kho_khuat" />
+    </Row>
+    <Row
+        latin:keyWidth="8.3333%p"
+    >
+        <Key
+            latin:keyStyle="shiftKeyStyle" />
+        <include
+            latin:keyboardLayout="@xml/rowkeys_thai4" />
         <Key
-            latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="fillRight"
-            latin:visualInsetsLeft="1%p" />
+            latin:keyStyle="deleteKeyStyle" />
     </Row>
     <include
         latin:keyboardLayout="@xml/row_qwerty4" />
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 0b4d706321f26145500a92d71af45fa19b6aa747..5b02f9f5a278315e8cfacf9ebf2d8d6a3bb808ef 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -647,7 +647,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
 
         // Draw key icon.
         if (key.mLabel == null && icon != null) {
-            final int iconWidth = icon.getIntrinsicWidth();
+            final int iconWidth = Math.min(icon.getIntrinsicWidth(), keyWidth);
             final int iconHeight = icon.getIntrinsicHeight();
             final int iconX, alignX;
             final int iconY = (keyHeight - iconHeight) / 2;