Adaptive keyboard width/position parser

This change introduces the following features to Keyboard XML format.

 * "keyXPos" can specify the key X coordinate directly.
 * "keyXPos" can be negative. The X coordinate will be calcluated from
    the right edge of the keyboard toward left.
 * "keyWidth" can be zero to be filled up to the right side.
 * "keyWidth can be negative. The key will be filled up to both sides.
 * Spacer's horizontalGap is renamed as keyWidth, and can be inherited
   from key-style.
 * Spacer can have keyXPos attribute.

Using these syntax, all keyboard layouts have been re-written.

Cherry-Pick: I314b2e8ca2aa145ff9506cbf927140a15685af42
Bug: 4442045
Change-Id: I048fe5eaef020d8472ab577e9d326042bae2f3fa
diff --git a/java/res/xml-sw768dp/kbd_ar_rows.xml b/java/res/xml-sw768dp/kbd_ar_rows.xml
index e84aae6..daaa38e 100644
--- a/java/res/xml-sw768dp/kbd_ar_rows.xml
+++ b/java/res/xml-sw768dp/kbd_ar_rows.xml
@@ -27,12 +27,12 @@
     <include
         latin:keyboardLayout="@xml/kbd_key_styles" />
     <Row
-        latin:keyWidth="7.49%p"
+        latin:keyWidth="7.579%p"
     >
         <Key
             latin:keyStyle="tabKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="7.949%p"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="ض" />
@@ -61,16 +61,17 @@
             latin:popupCharacters="ج,چ" />
         <Key
             latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="9.331%p"
+            latin:keyXPos="-9.219%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="7.49%p"
+        latin:keyWidth="7.500%p"
     >
         <Key
             latin:keyStyle="toSymbolKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="7.949%p"
+            latin:keyWidth="9.219%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="ش" />
@@ -100,16 +101,20 @@
             latin:keyLabel="ط" />
         <Key
             latin:keyStyle="returnKeyStyle"
-            latin:keyWidth="8.593%p"
+            latin:keyXPos="-15.704%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="8.042%p"
+        latin:keyWidth="7.500%p"
     >
         <Key
-            latin:keyLabel="ئ"
+            latin:keyStyle="shiftKeyStyle"
+            latin:keyWidth="9.219%p"
             latin:keyEdgeFlags="left" />
         <Key
+            latin:keyLabel="ئ" />
+        <Key
             latin:keyLabel="ء" />
         <Key
             latin:keyLabel="ؤ" />
@@ -132,7 +137,8 @@
             latin:keyLabel="د" />
         <Key
             latin:keyStyle="shiftKeyStyle"
-            latin:keyWidth="11.736%p"
+            latin:keyXPos="-13.750%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <include latin:keyboardLayout="@xml/kbd_qwerty_row4" />
diff --git a/java/res/xml-sw768dp/kbd_azerty_rows.xml b/java/res/xml-sw768dp/kbd_azerty_rows.xml
index 564f776..5288ccf 100644
--- a/java/res/xml-sw768dp/kbd_azerty_rows.xml
+++ b/java/res/xml-sw768dp/kbd_azerty_rows.xml
@@ -24,12 +24,12 @@
     <include
         latin:keyboardLayout="@xml/kbd_key_styles" />
     <Row
-        latin:keyWidth="8.272%p"
+        latin:keyWidth="8.282%p"
     >
         <Key
             latin:keyStyle="tabKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="7.949%p"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="a"
@@ -63,11 +63,12 @@
             latin:popupCharacters="@string/alternates_for_p" />
         <Key
             latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="9.331%p"
+            latin:keyXPos="-9.219%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="8.157%p"
+        latin:keyWidth="8.125%p"
     >
         <Key
             latin:keyStyle="toSymbolKeyStyle"
@@ -103,15 +104,16 @@
             latin:keyEdgeFlags="right" />
         <Key
             latin:keyStyle="returnKeyStyle"
-            latin:keyWidth="8.593%p"
+            latin:keyXPos="-15.704%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="8.042%p"
+        latin:keyWidth="8.047%p"
     >
         <Key
             latin:keyStyle="shiftKeyStyle"
-            latin:keyWidth="15.192%p"
+            latin:keyWidth="13.829%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="w"
@@ -161,7 +163,8 @@
         </switch>
         <Key
             latin:keyStyle="shiftKeyStyle"
-            latin:keyWidth="12.530%p"
+            latin:keyXPos="-13.750%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <include
diff --git a/java/res/xml-sw768dp/kbd_iw_rows.xml b/java/res/xml-sw768dp/kbd_iw_rows.xml
index a3a239d..33263f5 100644
--- a/java/res/xml-sw768dp/kbd_iw_rows.xml
+++ b/java/res/xml-sw768dp/kbd_iw_rows.xml
@@ -24,12 +24,12 @@
     <include
         latin:keyboardLayout="@xml/kbd_key_styles" />
     <Row
-        latin:keyWidth="8.272%p"
+        latin:keyWidth="8.282%p"
     >
         <Key
             latin:keyStyle="tabKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="7.949%p"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="," />
@@ -53,11 +53,12 @@
             latin:keyLabel="פ" />
         <Key
             latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="9.331%p"
+            latin:keyXPos="-9.219%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="8.157%p"
+        latin:keyWidth="8.125%p"
     >
         <Key
             latin:keyStyle="toSymbolKeyStyle"
@@ -89,15 +90,16 @@
             latin:keyLabel="ף" />
         <Key
             latin:keyStyle="returnKeyStyle"
-            latin:keyWidth="8.593%p"
+            latin:keyXPos="-15.704%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="8.042%p"
+        latin:keyWidth="8.047%p"
     >
         <Key
             latin:keyStyle="shiftKeyStyle"
-            latin:keyWidth="15.192%p"
+            latin:keyWidth="13.829%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="ז"
@@ -123,7 +125,8 @@
             latin:popupCharacters="ץ,ץ׳" />
         <Key
             latin:keyStyle="shiftKeyStyle"
-            latin:keyWidth="12.530%p"
+            latin:keyXPos="-13.750%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <include latin:keyboardLayout="@xml/kbd_qwerty_row4" />
diff --git a/java/res/xml-sw768dp/kbd_number.xml b/java/res/xml-sw768dp/kbd_number.xml
index 7cb77ea..01c41a5 100644
--- a/java/res/xml-sw768dp/kbd_number.xml
+++ b/java/res/xml-sw768dp/kbd_number.xml
@@ -24,7 +24,7 @@
     latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
     latin:minKeyboardHeight="@fraction/minKeyboardHeight"
     latin:rowHeight="25%p"
-    latin:keyWidth="11.949%p"
+    latin:keyWidth="11.954%p"
     latin:horizontalGap="@dimen/key_horizontal_gap"
     latin:verticalGap="@dimen/key_bottom_gap"
     latin:popupKeyboardTemplate="@xml/kbd_popup_template"
@@ -40,42 +40,42 @@
         >
             <!-- This row is intentionally not marked as a top row -->
             <Row>
-                <Spacer
-                    latin:horizontalGap="32.076%p" />
                 <Key
-                    latin:keyStyle="num1KeyStyle" />
+                    latin:keyStyle="tabKeyStyle"
+                    latin:keyLabelOption="alignLeft"
+                    latin:keyWidth="7.969%p"
+                    latin:keyEdgeFlags="left" />
+                <Key
+                    latin:keyStyle="num1KeyStyle"
+                    latin:keyXPos="32.076%p" />
                 <Key
                     latin:keyStyle="num2KeyStyle" />
                 <Key
                     latin:keyStyle="num3KeyStyle" />
-                <Spacer
-                    latin:horizontalGap="22.272%p" />
                 <Key
                     latin:keyStyle="deleteKeyStyle"
-                    latin:keyWidth="9.804%p"
+                    latin:keyXPos="-9.219%p"
+                    latin:keyWidth="fillRight"
                     latin:keyEdgeFlags="right" />
             </Row>
             <Row>
-                <Spacer
-                    latin:horizontalGap="32.076%p" />
                 <Key
-                    latin:keyStyle="num4KeyStyle" />
+                    latin:keyStyle="num4KeyStyle"
+                    latin:keyXPos="32.076%p" />
                 <Key
                     latin:keyStyle="num5KeyStyle" />
                 <Key
                     latin:keyStyle="num6KeyStyle" />
-                <Spacer
-                    latin:horizontalGap="17.371%p" />
                 <Key
                     latin:keyStyle="returnKeyStyle"
-                    latin:keyWidth="14.706%p"
+                    latin:keyXPos="-15.704%p"
+                    latin:keyWidth="fillRight"
                     latin:keyEdgeFlags="right" />
             </Row>
             <Row>
-                <Spacer
-                    latin:horizontalGap="32.076%p" />
                 <Key
-                    latin:keyStyle="num7KeyStyle" />
+                    latin:keyStyle="num7KeyStyle"
+                    latin:keyXPos="32.076%p" />
                 <Key
                     latin:keyStyle="num8KeyStyle" />
                 <Key
@@ -87,7 +87,7 @@
             <!-- This row is intentionally not marked as a bottom row -->
             <Row>
                 <Spacer
-                    latin:horizontalGap="44.026%p" />
+                    latin:keyXPos="32.076%p" />
                 <Key
                     latin:keyStyle="num0KeyStyle" />
                 <!-- There is an empty area below the "Enter" key and right of the "#" key. To
@@ -102,79 +102,72 @@
                 <Key
                     latin:keyStyle="tabKeyStyle"
                     latin:keyLabelOption="alignLeft"
+                    latin:keyWidth="7.969%p"
                     latin:keyEdgeFlags="left" />
-                <Spacer
-                    latin:horizontalGap="4.458%p" />
                 <Key
                     latin:keyLabel="-"
-                    latin:keyWidth="8.042%p" />
+                    latin:keyXPos="13.829%p"
+                    latin:keyWidth="8.047%p" />
                 <Key
                     latin:keyLabel="+"
-                    latin:keyWidth="8.042%p" />
+                    latin:keyWidth="8.047%p" />
                 <Key
                     latin:keyLabel="."
-                    latin:keyWidth="8.042%p" />
-                <Spacer
-                    latin:horizontalGap="4.458%p" />
+                    latin:keyWidth="8.047%p" />
                 <Key
-                    latin:keyLabel="1" />
+                    latin:keyLabel="1"
+                    latin:keyXPos="45.000%p" />
                 <Key
                     latin:keyLabel="2" />
                 <Key
                     latin:keyLabel="3" />
-                <Spacer
-                    latin:horizontalGap="9.360%p" />
                 <Key
                     latin:keyStyle="deleteKeyStyle"
-                    latin:keyWidth="9.804%p"
+                    latin:keyXPos="-9.219%p"
+                    latin:keyWidth="fillRight"
                     latin:keyEdgeFlags="right" />
             </Row>
             <Row>
-                <Spacer
-                    latin:horizontalGap="16.406%p" />
                 <Key
                     latin:keyLabel="*"
-                    latin:keyWidth="8.042%p" />
+                    latin:keyXPos="13.829%p"
+                    latin:keyWidth="8.047%p" />
                 <Key
                     latin:keyLabel="/"
-                    latin:keyWidth="8.042%p" />
+                    latin:keyWidth="8.047%p" />
                 <Key
                     latin:keyLabel=","
-                    latin:keyWidth="8.042%p" />
-                <Spacer
-                    latin:horizontalGap="4.458%p" />
+                    latin:keyWidth="8.047%p" />
                 <Key
-                    latin:keyLabel="4" />
+                    latin:keyLabel="4"
+                    latin:keyXPos="45.000%p" />
                 <Key
                     latin:keyLabel="5" />
                 <Key
                     latin:keyLabel="6" />
-                <Spacer
-                    latin:horizontalGap="4.458%p" />
                 <Key
                     latin:keyStyle="returnKeyStyle"
-                    latin:keyWidth="14.706%p"
+                    latin:keyXPos="-15.704%p"
+                    latin:keyWidth="fillRight"
                     latin:keyEdgeFlags="right" />
             </Row>
             <Row>
                 <!-- There is an empty area below the "More" key and left of the "(" key. To
                      ignore the touch event on the area, "(" is intentionally not marked as a left
                      edge key. -->
-                <Spacer
-                    latin:horizontalGap="16.406%p" />
                 <Key
                     latin:keyLabel="("
-                    latin:keyWidth="8.042%p" />
+                    latin:keyXPos="13.829%p"
+                    latin:keyWidth="8.047%p" />
                 <Key
                     latin:keyLabel=")"
-                    latin:keyWidth="8.042%p" />
+                    latin:keyWidth="8.047%p" />
                 <Key
                     latin:keyLabel="="
-                    latin:keyWidth="8.042%p" />
-                <Spacer
-                    latin:horizontalGap="4.458%p" />
+                    latin:keyWidth="8.047%p" />
                 <Key
-                    latin:keyLabel="7" />
+                    latin:keyLabel="7"
+                    latin:keyXPos="45.000%p" />
                 <Key
                     latin:keyLabel="8" />
                 <Key
@@ -185,29 +178,20 @@
             </Row>
             <!-- This row is intentionally not marked as a bottom row -->
             <Row>
-                <!-- There is an empty area below the "More" key and left of the "space" key. To
-                     ignore the touch event on the area, "space" is intentionally not marked as a
-                     left edge key. -->
-                <Spacer
-                    latin:horizontalGap="8.362%p" />
                 <switch>
                     <case latin:hasSettingsKey="true">
                         <Key
                             latin:keyStyle="settingsKeyStyle"
-                            latin:keyWidth="8.042%p" />
+                            latin:keyWidth="8.047%p" />
                     </case>
-                    <default>
-                        <Spacer
-                            latin:horizontalGap="8.042%p" />
-                    </default>
                 </switch>
                 <Key
                     latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle"
-                    latin:keyWidth="24.127%p" />
-                <Spacer
-                    latin:horizontalGap="4.458%p" />
+                    latin:keyXPos="13.829%p"
+                    latin:keyWidth="24.140%p" />
                 <Key
-                    latin:keyLabel="*" />
+                    latin:keyLabel="*"
+                    latin:keyXPos="45.000%p" />
                 <Key
                     latin:keyLabel="0" />
                 <Key
@@ -218,12 +202,10 @@
                     >
                         <Key
                             latin:keyStyle="micKeyStyle"
-                            latin:keyWidth="8.042%p" />
+                            latin:keyXPos="-8.047%p"
+                            latin:keyWidth="fillRight" />
                     </case>
                 </switch>
-                <!-- There is an empty area below the "Enter" key and right of the "#" key. To
-                     ignore the touch event on the area, "#" is intentionally not marked as a right
-                     edge key. -->
             </Row>
         </default>
     </switch>
diff --git a/java/res/xml-sw768dp/kbd_phone.xml b/java/res/xml-sw768dp/kbd_phone.xml
index 60edcf2..583239a 100644
--- a/java/res/xml-sw768dp/kbd_phone.xml
+++ b/java/res/xml-sw768dp/kbd_phone.xml
@@ -24,7 +24,7 @@
     latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
     latin:minKeyboardHeight="@fraction/minKeyboardHeight"
     latin:rowHeight="25%p"
-    latin:keyWidth="11.949%p"
+    latin:keyWidth="11.954%p"
     latin:horizontalGap="@dimen/key_horizontal_gap"
     latin:verticalGap="@dimen/key_bottom_gap"
     latin:popupKeyboardTemplate="@xml/kbd_popup_template"
@@ -39,115 +39,101 @@
         <Key
             latin:keyStyle="tabKeyStyle"
             latin:keyLabelOption="alignLeft"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
         <!-- To match one character label size with "Tab", I placed spaces around the char '-'
              and '+'. -->
-        <Spacer
-            latin:horizontalGap="8.470%p" />
         <Key
             latin:code="45"
             latin:keyLabel=" - "
-            latin:keyWidth="8.042%p" />
+            latin:keyXPos="20.400%p"
+            latin:keyWidth="8.047%p" />
         <Key
             latin:code="43"
             latin:keyLabel=" + "
-            latin:keyWidth="8.042%p" />
-        <Spacer
-            latin:horizontalGap="8.479%p" />
+            latin:keyWidth="8.047%p" />
         <Key
-            latin:keyStyle="num1KeyStyle" />
+            latin:keyStyle="num1KeyStyle"
+            latin:keyXPos="45.000%p" />
         <Key
             latin:keyStyle="num2KeyStyle" />
         <Key
             latin:keyStyle="num3KeyStyle" />
-        <Spacer
-            latin:horizontalGap="9.360%p" />
         <Key
             latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="9.804%p"
+            latin:keyXPos="-9.219%p"
+            latin:keyWidth="fillRight"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row>
         <Key
             latin:keyStyle="moreKeyStyle"
+            latin:keyWidth="11.172%p"
             latin:keyEdgeFlags="left" />
         <!-- To match one character label size with "More", I placed spaces around the char ','
              and '.'. -->
-        <Spacer
-            latin:horizontalGap="8.470%p" />
         <Key
             latin:code="44"
             latin:keyLabel=" , "
-            latin:keyWidth="8.042%p" />
+            latin:keyXPos="20.400%p"
+            latin:keyWidth="8.047%p" />
         <Key
             latin:code="46"
             latin:keyLabel=" . "
-            latin:keyWidth="8.042%p" />
-        <Spacer
-            latin:horizontalGap="8.479%p" />
+            latin:keyWidth="8.047%p" />
         <Key
-            latin:keyStyle="num4KeyStyle" />
+            latin:keyStyle="num4KeyStyle"
+            latin:keyXPos="45.000%p" />
         <Key
             latin:keyStyle="num5KeyStyle" />
         <Key
             latin:keyStyle="num6KeyStyle" />
-        <Spacer
-            latin:horizontalGap="4.458%p" />
         <Key
             latin:keyStyle="returnKeyStyle"
-            latin:keyWidth="14.706%p"
+            latin:keyXPos="-15.704%p"
+            latin:keyWidth="fillRight"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row>
         <!-- To match one character label size with "More", I placed spaces around the char '('
              and ')'. -->
-        <!-- There is an empty area bellow the "More" key and left of the "(" key.  To ignore
+        <!-- There is an empty area below the "More" key and left of the "(" key.  To ignore
              the touch event on the area, "(" is intentionally not marked as a left edge key. -->
-        <Spacer
-            latin:horizontalGap="20.427%p" />
         <Key
             latin:code="40"
             latin:keyLabel=" ( "
-            latin:keyWidth="8.042%p" />
+            latin:keyXPos="20.400%p"
+            latin:keyWidth="8.047%p" />
         <Key
             latin:code="41"
             latin:keyLabel=" ) "
-            latin:keyWidth="8.042%p" />
-        <Spacer
-            latin:horizontalGap="8.479%p" />
+            latin:keyWidth="8.047%p" />
         <Key
-            latin:keyStyle="num7KeyStyle" />
+            latin:keyStyle="num7KeyStyle"
+            latin:keyXPos="45.000%p" />
         <Key
             latin:keyStyle="num8KeyStyle" />
         <Key
             latin:keyStyle="num9KeyStyle" />
-        <!-- There is an empty area bellow the "Enter" key and right of the "9" key.  To ignore
+        <!-- There is an empty area below the "Enter" key and right of the "9" key.  To ignore
              the touch event on the area, "9" is intentionally not marked as a right edge key. -->
         </Row>
     <!-- This row is intentionally not marked as a bottom row -->
     <Row>
-        <!-- There is an empty area bellow the "More" key and left of the "space" key.  To ignore
-             the touch event on the area, "space" is intentionally not marked as a left edge key. -->
-        <Spacer
-            latin:horizontalGap="12.340%p" />
         <switch>
             <case latin:hasSettingsKey="true">
                 <Key
                     latin:keyStyle="settingsKeyStyle"
-                    latin:keyWidth="8.042%p" />
+                    latin:keyWidth="8.047%p" />
             </case>
-            <default>
-                <Spacer
-                    latin:horizontalGap="8.042%p" />
-            </default>
         </switch>
         <Key
             latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle"
+            latin:keyXPos="20.400%p"
             latin:keyWidth="16.084%p" />
-        <Spacer
-            latin:horizontalGap="8.479%p" />
         <Key
-            latin:keyStyle="numStarKeyStyle" />
+            latin:keyStyle="numStarKeyStyle"
+            latin:keyXPos="45.000%p" />
         <Key
             latin:keyStyle="num0KeyStyle" />
         <Key
@@ -158,10 +144,9 @@
             >
                 <Key
                     latin:keyStyle="micKeyStyle"
-                    latin:keyWidth="8.042%p" />
+                    latin:keyXPos="-8.047%p"
+                    latin:keyWidth="fillRight" />
             </case>
         </switch>
-        <!-- There is an empty area bellow the "Enter" key and right of the "#" key.  To ignore
-             the touch event on the area, "#" is intentionally not marked as a right edge key. -->
     </Row>
 </Keyboard>
diff --git a/java/res/xml-sw768dp/kbd_phone_symbols.xml b/java/res/xml-sw768dp/kbd_phone_symbols.xml
index c388a46..714e5e5 100644
--- a/java/res/xml-sw768dp/kbd_phone_symbols.xml
+++ b/java/res/xml-sw768dp/kbd_phone_symbols.xml
@@ -24,7 +24,7 @@
     latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
     latin:minKeyboardHeight="@fraction/minKeyboardHeight"
     latin:rowHeight="25%p"
-    latin:keyWidth="11.949%p"
+    latin:keyWidth="11.954%p"
     latin:horizontalGap="@dimen/key_horizontal_gap"
     latin:verticalGap="@dimen/key_bottom_gap"
     latin:popupKeyboardTemplate="@xml/kbd_popup_template"
@@ -39,127 +39,113 @@
         <Key
             latin:keyStyle="tabKeyStyle"
             latin:keyLabelOption="alignLeft"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
-        <Spacer
-            latin:horizontalGap="4.458%p" />
         <Key
             latin:code="45"
             latin:keyLabel=" - "
-            latin:keyWidth="8.042%p" />
+            latin:keyXPos="13.829%p"
+            latin:keyWidth="8.047%p" />
         <Key
             latin:code="43"
             latin:keyLabel=" + "
-            latin:keyWidth="8.042%p" />
+            latin:keyWidth="8.047%p" />
         <Key
             latin:code="44"
             latin:keyLabel="@string/label_pause_key"
-            latin:keyWidth="8.042%p" />
+            latin:keyWidth="8.047%p" />
         <!-- To match one character label size with "Tab" and "Pause, I placed spaces around the
              char '-' and '+'. -->
-        <Spacer
-            latin:horizontalGap="4.458%p" />
         <Key
-            latin:keyStyle="num1KeyStyle" />
+            latin:keyStyle="num1KeyStyle"
+            latin:keyXPos="45.000%p" />
         <Key
             latin:keyStyle="num2KeyStyle" />
         <Key
             latin:keyStyle="num3KeyStyle" />
-        <Spacer
-            latin:horizontalGap="9.360%p" />
         <Key
             latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="9.804%p"
+            latin:keyXPos="-9.219%p"
+            latin:keyWidth="fillRight"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row>
         <Key
             latin:keyStyle="moreKeyStyle"
+            latin:keyWidth="11.172%p"
             latin:keyEdgeFlags="left" />
-        <Spacer
-            latin:horizontalGap="4.458%p" />
         <Key
             latin:code="44"
             latin:keyLabel=" , "
-            latin:keyWidth="8.042%p" />
+            latin:keyXPos="13.829%p"
+            latin:keyWidth="8.047%p" />
         <Key
             latin:code="46"
             latin:keyLabel=" . "
-            latin:keyWidth="8.042%p" />
+            latin:keyWidth="8.047%p" />
         <Key
             latin:code="59"
             latin:keyLabel="@string/label_wait_key"
-            latin:keyWidth="8.042%p" />
+            latin:keyWidth="8.047%p" />
         <!-- To match one character label size with "More" and "Wait", I placed spaces around the
              char ',' and '.'. -->
-        <Spacer
-            latin:horizontalGap="4.458%p" />
         <Key
-            latin:keyStyle="num4KeyStyle" />
+            latin:keyStyle="num4KeyStyle"
+            latin:keyXPos="45.000%p" />
         <Key
             latin:keyStyle="num5KeyStyle" />
         <Key
             latin:keyStyle="num6KeyStyle" />
-        <Spacer
-            latin:horizontalGap="4.458%p" />
         <Key
             latin:keyStyle="returnKeyStyle"
-            latin:keyWidth="14.706%p"
+            latin:keyXPos="-15.704%p"
+            latin:keyWidth="fillRight"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row>
         <!-- To match one character label size with "More" and etc., I placed spaces around the
              char 'N', '(' and ')'. -->
-        <!-- There is an empty area bellow the "More" key and left of the "(" key.  To ignore
+        <!-- There is an empty area below the "More" key and left of the "(" key.  To ignore
              the touch event on the area, "(" is intentionally not marked as a left edge key. -->
-        <Spacer
-            latin:horizontalGap="16.406%p" />
         <Key
             latin:code="40"
             latin:keyLabel=" ( "
-            latin:keyWidth="8.042%p" />
+            latin:keyXPos="13.829%p"
+            latin:keyWidth="8.047%p" />
         <Key
             latin:code="41"
             latin:keyLabel=" ) "
-            latin:keyWidth="8.042%p" />
+            latin:keyWidth="8.047%p" />
         <Key
             latin:code="78"
             latin:keyLabel=" N "
-            latin:keyWidth="8.042%p" />
-        <Spacer
-            latin:horizontalGap="4.458%p" />
+            latin:keyWidth="8.047%p" />
         <Key
-            latin:keyStyle="num7KeyStyle" />
+            latin:keyStyle="num7KeyStyle"
+            latin:keyXPos="45.000%p" />
         <Key
             latin:keyStyle="num8KeyStyle" />
         <Key
             latin:keyStyle="num9KeyStyle" />
-        <!-- There is an empty area bellow the "Enter" key and right of the "9" key.  To ignore
+        <!-- There is an empty area below the "Enter" key and right of the "9" key.  To ignore
              the touch event on the area, "9" is intentionally not marked as a right edge key. -->
     </Row>
     <!-- This row is intentionally not marked as a bottom row -->
     <Row>
-        <!-- There is an empty area bellow the "More" key and left of the "space" key.  To ignore
-             the touch event on the area, "space" is intentionally not marked as a left edge key. -->
-        <Spacer
-            latin:horizontalGap="8.362%p" />
         <switch>
             <case latin:hasSettingsKey="true">
                 <Key
                     latin:keyStyle="settingsKeyStyle"
-                    latin:keyWidth="8.042%p" />
+                    latin:keyWidth="8.047%p" />
             </case>
-            <default>
-                <Spacer
-                    latin:horizontalGap="8.042%p" />
-            </default>
         </switch>
         <Key
             latin:keyStyle="nonSpecialBackgroundSpaceKeyStyle"
-            latin:keyWidth="24.127%p" />
-        <Spacer
-            latin:horizontalGap="4.458%p" />
+            latin:keyXPos="13.829%p"
+            latin:keyWidth="24.140%p" />
         <Key
-            latin:keyStyle="numStarKeyStyle" />
+            latin:keyStyle="numStarKeyStyle"
+            latin:keyXPos="45.000%p" />
         <Key
             latin:keyStyle="num0KeyStyle" />
         <Key
@@ -170,10 +156,9 @@
             >
                 <Key
                     latin:keyStyle="micKeyStyle"
-                    latin:keyWidth="8.042%p" />
+                    latin:keyXPos="-8.047%p"
+                    latin:keyWidth="fillRight" />
             </case>
         </switch>
-        <!-- There is an empty area bellow the "Enter" key and right of the "#" key.  To ignore
-             the touch event on the area, "#" is intentionally not marked as a right edge key. -->
     </Row>
 </Keyboard>
diff --git a/java/res/xml-sw768dp/kbd_qwerty_row1.xml b/java/res/xml-sw768dp/kbd_qwerty_row1.xml
index f513559..3727cf3 100644
--- a/java/res/xml-sw768dp/kbd_qwerty_row1.xml
+++ b/java/res/xml-sw768dp/kbd_qwerty_row1.xml
@@ -23,12 +23,12 @@
 >
     <!-- This row is intentionally not marked as a top row -->
     <Row
-        latin:keyWidth="8.272%p"
+        latin:keyWidth="8.282%p"
     >
         <Key
             latin:keyStyle="tabKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="7.949%p"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="q"
@@ -62,7 +62,8 @@
             latin:popupCharacters="@string/alternates_for_p" />
         <Key
             latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="9.331%p"
+            latin:keyXPos="-9.219%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
 </merge>
diff --git a/java/res/xml-sw768dp/kbd_qwerty_row2.xml b/java/res/xml-sw768dp/kbd_qwerty_row2.xml
index 02bd0a6..45af120 100644
--- a/java/res/xml-sw768dp/kbd_qwerty_row2.xml
+++ b/java/res/xml-sw768dp/kbd_qwerty_row2.xml
@@ -22,12 +22,12 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
 >
     <Row
-        latin:keyWidth="8.157%p"
+        latin:keyWidth="8.125%p"
     >
         <Key
             latin:keyStyle="toSymbolKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="11.167%p"
+            latin:keyWidth="11.172%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="a"
@@ -55,7 +55,8 @@
             latin:popupCharacters="@string/alternates_for_l" />
         <Key
             latin:keyStyle="returnKeyStyle"
-            latin:keyWidth="15.750%p"
+            latin:keyXPos="-15.704%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
 </merge>
diff --git a/java/res/xml-sw768dp/kbd_qwerty_row3.xml b/java/res/xml-sw768dp/kbd_qwerty_row3.xml
index b7e9bcf..7d59dfb 100644
--- a/java/res/xml-sw768dp/kbd_qwerty_row3.xml
+++ b/java/res/xml-sw768dp/kbd_qwerty_row3.xml
@@ -22,11 +22,11 @@
     xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
 >
     <Row
-        latin:keyWidth="8.042%p"
+        latin:keyWidth="8.047%p"
     >
         <Key
             latin:keyStyle="shiftKeyStyle"
-            latin:keyWidth="15.192%p"
+            latin:keyWidth="13.829%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="z"
@@ -72,7 +72,8 @@
         </switch>
         <Key
             latin:keyStyle="shiftKeyStyle"
-            latin:keyWidth="12.530%p"
+            latin:keyXPos="-13.750%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
 </merge>
diff --git a/java/res/xml-sw768dp/kbd_qwerty_row4.xml b/java/res/xml-sw768dp/kbd_qwerty_row4.xml
index e5bc342..b24ea5e 100644
--- a/java/res/xml-sw768dp/kbd_qwerty_row4.xml
+++ b/java/res/xml-sw768dp/kbd_qwerty_row4.xml
@@ -23,20 +23,18 @@
 >
     <!-- This row is intentionally not marked as a bottom row -->
     <Row
-        latin:keyWidth="8.042%p"
+        latin:keyWidth="8.047%p"
     >
-        <Spacer
-            latin:horizontalGap="8.362%p" />
         <switch>
             <case latin:hasSettingsKey="true">
                 <Key
-                    latin:keyStyle="settingsKeyStyle" />
+                    latin:keyStyle="settingsKeyStyle"
+                    latin:keyWidth="8.047%p" />
             </case>
-            <default>
-                <Spacer
-                    latin:horizontalGap="8.042%p" />
-            </default>
         </switch>
+        <Spacer
+            latin:keyXPos="15.157%p"
+            latin:keyWidth="fillRight" />
         <switch>
             <case
                 latin:languageCode="ru"
@@ -152,7 +150,8 @@
         </switch>
         <Key
             latin:keyStyle="spaceKeyStyle"
-            latin:keyWidth="37.454%p" />
+            latin:keyXPos="31.250%p"
+            latin:keyWidth="37.500%p" />
         <switch>
             <case
                 latin:languageCode="ru"
@@ -251,7 +250,9 @@
                 latin:voiceKeyEnabled="true"
             >
                 <Key
-                    latin:keyStyle="micKeyStyle" />
+                    latin:keyStyle="micKeyStyle"
+                    latin:keyXPos="-8.047%p"
+                    latin:keyWidth="fillRight" />
             </case>
         </switch>
     </Row>
diff --git a/java/res/xml-sw768dp/kbd_qwerty_rows_scandinavia.xml b/java/res/xml-sw768dp/kbd_qwerty_rows_scandinavia.xml
index fb2034f..b887528 100644
--- a/java/res/xml-sw768dp/kbd_qwerty_rows_scandinavia.xml
+++ b/java/res/xml-sw768dp/kbd_qwerty_rows_scandinavia.xml
@@ -24,12 +24,12 @@
     <include
         latin:keyboardLayout="@xml/kbd_key_styles" />
     <Row
-        latin:keyWidth="7.520%p"
+        latin:keyWidth="7.579%p"
     >
         <Key
             latin:keyStyle="tabKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="7.949%p"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="q"
@@ -65,16 +65,17 @@
             latin:keyLabel="å" />
         <Key
             latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="9.331%p"
+            latin:keyXPos="-9.219%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="7.520%p"
+        latin:keyWidth="7.500%p"
     >
         <Key
             latin:keyStyle="toSymbolKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="7.949%p"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="a"
@@ -108,7 +109,8 @@
             latin:popupCharacters="@string/alternates_for_scandinavia_row2_11" />
         <Key
             latin:keyStyle="returnKeyStyle"
-            latin:keyWidth="9.331%p"
+            latin:keyXPos="-15.704%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <include
diff --git a/java/res/xml-sw768dp/kbd_qwertz_rows.xml b/java/res/xml-sw768dp/kbd_qwertz_rows.xml
index 3e99f05..4e937ac 100644
--- a/java/res/xml-sw768dp/kbd_qwertz_rows.xml
+++ b/java/res/xml-sw768dp/kbd_qwertz_rows.xml
@@ -24,12 +24,12 @@
     <include
         latin:keyboardLayout="@xml/kbd_key_styles" />
     <Row
-        latin:keyWidth="8.272%p"
+        latin:keyWidth="8.282%p"
     >
         <Key
             latin:keyStyle="tabKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="7.949%p"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="q"
@@ -63,17 +63,18 @@
             latin:popupCharacters="@string/alternates_for_p" />
         <Key
             latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="9.331%p"
+            latin:keyXPos="-9.219%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <include
         latin:keyboardLayout="@xml/kbd_qwerty_row2" />
     <Row
-        latin:keyWidth="8.042%p"
+        latin:keyWidth="8.047%p"
     >
         <Key
             latin:keyStyle="shiftKeyStyle"
-            latin:keyWidth="15.192%p"
+            latin:keyWidth="13.829%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="y"
@@ -119,7 +120,8 @@
         </switch>
         <Key
             latin:keyStyle="shiftKeyStyle"
-            latin:keyWidth="12.530%p"
+            latin:keyXPos="-13.750%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
    <include
diff --git a/java/res/xml-sw768dp/kbd_ru_rows.xml b/java/res/xml-sw768dp/kbd_ru_rows.xml
index c5cd043..3849141 100644
--- a/java/res/xml-sw768dp/kbd_ru_rows.xml
+++ b/java/res/xml-sw768dp/kbd_ru_rows.xml
@@ -25,57 +25,49 @@
         latin:keyboardLayout="@xml/kbd_key_styles" />
     <!-- This row is intentionally not marked as a top row -->
     <Row
-        latin:keyWidth="7.520%p"
+        latin:keyWidth="7.579%p"
     >
         <Key
             latin:keyStyle="tabKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="7.949%p"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
         <Key
-            latin:keyLabel="й"
-            latin:popupCharacters="1" />
+            latin:keyLabel="й" />
         <Key
-            latin:keyLabel="ц"
-            latin:popupCharacters="2" />
+            latin:keyLabel="ц" />
         <Key
-            latin:keyLabel="у"
-            latin:popupCharacters="3" />
+            latin:keyLabel="у" />
         <Key
-            latin:keyLabel="к"
-            latin:popupCharacters="4" />
+            latin:keyLabel="к" />
         <Key
             latin:keyLabel="е"
             latin:popupCharacters="@string/alternates_for_cyrillic_e" />
         <Key
-            latin:keyLabel="н"
-            latin:popupCharacters="6" />
+            latin:keyLabel="н" />
         <Key
-            latin:keyLabel="г"
-            latin:popupCharacters="7" />
+            latin:keyLabel="г" />
         <Key
-            latin:keyLabel="ш"
-            latin:popupCharacters="8" />
+            latin:keyLabel="ш" />
         <Key
-            latin:keyLabel="щ"
-            latin:popupCharacters="9" />
+            latin:keyLabel="щ" />
         <Key
-            latin:keyLabel="з"
-            latin:popupCharacters="0" />
+            latin:keyLabel="з" />
         <Key
             latin:keyLabel="х" />
         <Key
             latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="9.331%p"
+            latin:keyXPos="-9.219%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="7.520%p"
+        latin:keyWidth="7.500%p"
     >
         <Key
             latin:keyStyle="toSymbolKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="7.949%p"
+            latin:keyWidth="9.219%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="ф" />
@@ -101,11 +93,12 @@
             latin:keyLabel="э" />
         <Key
             latin:keyStyle="returnKeyStyle"
-            latin:keyWidth="9.331%p"
+            latin:keyXPos="-15.704%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="7.520%p"
+        latin:keyWidth="7.500%p"
     >
         <Key
             latin:keyStyle="shiftKeyStyle"
@@ -138,7 +131,8 @@
             latin:popupCharacters="," />
         <Key
             latin:keyStyle="shiftKeyStyle"
-            latin:keyWidth="12.400%p"
+            latin:keyXPos="-13.750%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <include
diff --git a/java/res/xml-sw768dp/kbd_sr_rows.xml b/java/res/xml-sw768dp/kbd_sr_rows.xml
index be00585..fbf1e9b 100644
--- a/java/res/xml-sw768dp/kbd_sr_rows.xml
+++ b/java/res/xml-sw768dp/kbd_sr_rows.xml
@@ -25,57 +25,48 @@
         latin:keyboardLayout="@xml/kbd_key_styles" />
     <!-- This row is intentionally not marked as a top row -->
     <Row
-        latin:keyWidth="7.520%p"
+        latin:keyWidth="7.579%p"
     >
         <Key
             latin:keyStyle="tabKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="8.640%p"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
         <Key
-            latin:keyLabel="љ"
-            latin:popupCharacters="1" />
+            latin:keyLabel="љ" />
         <Key
-            latin:keyLabel="њ"
-            latin:popupCharacters="2" />
+            latin:keyLabel="њ" />
         <Key
-            latin:keyLabel="е"
-            latin:popupCharacters="3" />
+            latin:keyLabel="е" />
         <Key
-            latin:keyLabel="р"
-            latin:popupCharacters="4" />
+            latin:keyLabel="р" />
         <Key
-            latin:keyLabel="т"
-            latin:popupCharacters="5" />
+            latin:keyLabel="т" />
         <Key
-            latin:keyLabel="з"
-            latin:popupCharacters="6" />
+            latin:keyLabel="з" />
         <Key
-            latin:keyLabel="у"
-            latin:popupCharacters="7" />
+            latin:keyLabel="у" />
         <Key
-            latin:keyLabel="и"
-            latin:popupCharacters="8" />
+            latin:keyLabel="и" />
         <Key
-            latin:keyLabel="о"
-            latin:popupCharacters="9" />
+            latin:keyLabel="о" />
         <Key
-            latin:keyLabel="п"
-            latin:popupCharacters="0" />
+            latin:keyLabel="п" />
         <Key
             latin:keyLabel="ш" />
         <Key
             latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="8.640%p"
+            latin:keyXPos="-9.219%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="7.520%p"
+        latin:keyWidth="7.500%p"
     >
         <Key
             latin:keyStyle="toSymbolKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="8.640%p"
+            latin:keyWidth="9.219%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="а" />
@@ -101,15 +92,16 @@
             latin:keyLabel="ћ" />
         <Key
             latin:keyStyle="returnKeyStyle"
-            latin:keyWidth="8.640%p"
+            latin:keyXPos="-15.704%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="7.520%p"
+        latin:keyWidth="7.500%p"
     >
         <Key
             latin:keyStyle="shiftKeyStyle"
-            latin:keyWidth="8.640%p"
+            latin:keyWidth="9.219%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="ѕ" />
@@ -143,7 +135,8 @@
             latin:popupCharacters="\?" />
         <Key
             latin:keyStyle="shiftKeyStyle"
-            latin:keyWidth="8.640%p"
+            latin:keyXPos="-13.750%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <include
diff --git a/java/res/xml-sw768dp/kbd_symbols.xml b/java/res/xml-sw768dp/kbd_symbols.xml
index 41e8522..26cf1ac 100644
--- a/java/res/xml-sw768dp/kbd_symbols.xml
+++ b/java/res/xml-sw768dp/kbd_symbols.xml
@@ -35,12 +35,12 @@
         latin:keyboardLayout="@xml/kbd_currency_key_styles" />
     <!-- This row is intentionally not marked as a top row -->
     <Row
-        latin:keyWidth="8.272%p"
+        latin:keyWidth="8.282%p"
     >
         <Key
             latin:keyStyle="tabKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="7.949%p"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="1"
@@ -71,16 +71,17 @@
             latin:popupCharacters="ⁿ,∅" />
         <Key
             latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="9.331%p"
+            latin:keyXPos="-9.219%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="8.157%p"
+        latin:keyWidth="8.125%p"
     >
         <Key
             latin:keyStyle="toAlphaKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="11.167%p"
+            latin:keyWidth="11.172%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="#" />
@@ -108,15 +109,16 @@
             latin:popupCharacters="],},&gt;" />
         <Key
             latin:keyStyle="returnKeyStyle"
-            latin:keyWidth="15.750%p"
+            latin:keyXPos="-15.704%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="8.042%p"
+        latin:keyWidth="8.047%p"
     >
         <Key
             latin:keyStyle="moreKeyStyle"
-            latin:keyWidth="15.192%p"
+            latin:keyWidth="13.829%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="&lt;"
@@ -180,32 +182,30 @@
         </switch>
         <Key
             latin:keyStyle="moreKeyStyle"
-            latin:keyWidth="12.530%p"
+            latin:keyXPos="-13.750%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <!-- This row is intentionally not marked as a bottom row -->
     <Row
-        latin:keyWidth="8.042%p"
+        latin:keyWidth="8.047%p"
     >
-        <Spacer
-            latin:horizontalGap="8.362%p" />
         <switch>
             <case latin:hasSettingsKey="true">
                 <Key
-                    latin:keyStyle="settingsKeyStyle" />
+                    latin:keyStyle="settingsKeyStyle"
+                    latin:keyWidth="8.047%p" />
             </case>
-            <default>
-                <Spacer
-                    latin:horizontalGap="8.042%p" />
-            </default>
         </switch>
         <Key
-            latin:keyLabel="/" />
+            latin:keyLabel="/"
+            latin:keyXPos="15.157%p" />
         <Key
             latin:keyLabel="\@" />
         <Key
             latin:keyStyle="spaceKeyStyle"
-            latin:keyWidth="37.454%p" />
+            latin:keyXPos="31.250%p"
+            latin:keyWidth="37.500%p" />
         <switch>
             <case
                 latin:languageCode="ru"
@@ -230,7 +230,9 @@
                 latin:voiceKeyEnabled="true"
             >
                 <Key
-                    latin:keyStyle="micKeyStyle" />
+                    latin:keyStyle="micKeyStyle"
+                    latin:keyXPos="-8.047%p"
+                    latin:keyWidth="fillRight" />
             </case>
         </switch>
     </Row>
diff --git a/java/res/xml-sw768dp/kbd_symbols_shift.xml b/java/res/xml-sw768dp/kbd_symbols_shift.xml
index d7f5958..94bd761 100644
--- a/java/res/xml-sw768dp/kbd_symbols_shift.xml
+++ b/java/res/xml-sw768dp/kbd_symbols_shift.xml
@@ -33,12 +33,12 @@
         latin:keyboardLayout="@xml/kbd_key_styles" />
     <!-- This row is intentionally not marked as a top row -->
     <Row
-        latin:keyWidth="8.272%p"
+        latin:keyWidth="8.282%p"
     >
         <Key
             latin:keyStyle="tabKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="7.949%p"
+            latin:keyWidth="7.969%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="~" />
@@ -72,16 +72,17 @@
             latin:keyLabel="Δ" />
         <Key
             latin:keyStyle="deleteKeyStyle"
-            latin:keyWidth="9.331%p"
+            latin:keyXPos="-9.219%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="8.157%p"
+        latin:keyWidth="8.125%p"
     >
         <Key
             latin:keyStyle="toAlphaKeyStyle"
             latin:keyLabelOption="alignLeft"
-            latin:keyWidth="11.167%p"
+            latin:keyWidth="11.172%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyStyle="nonPasswordSymbolKeyStyle"
@@ -112,15 +113,16 @@
             latin:keyLabel="}" />
         <Key
             latin:keyStyle="returnKeyStyle"
-            latin:keyWidth="15.750%p"
+            latin:keyXPos="-15.704%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <Row
-        latin:keyWidth="8.042%p"
+        latin:keyWidth="8.047%p"
     >
         <Key
             latin:keyStyle="moreKeyStyle"
-            latin:keyWidth="15.192%p"
+            latin:keyWidth="13.829%p"
             latin:keyEdgeFlags="left" />
         <Key
             latin:keyLabel="\\" />
@@ -148,34 +150,33 @@
             latin:keyLabel="¿" />
         <Key
             latin:keyStyle="moreKeyStyle"
-            latin:keyWidth="12.530%p"
+            latin:keyXPos="-13.750%p"
+            latin:keyWidth="fillBoth"
             latin:keyEdgeFlags="right" />
     </Row>
     <!-- This row is intentionally not marked as a bottom row -->
     <Row
-        latin:keyWidth="8.042%p"
+        latin:keyWidth="8.047%p"
     >
-        <Spacer
-            latin:horizontalGap="24.446%p" />
         <switch>
             <case latin:hasSettingsKey="true">
                 <Key
-                    latin:keyStyle="settingsKeyStyle" />
+                    latin:keyStyle="settingsKeyStyle"
+                    latin:keyWidth="8.047%p" />
             </case>
-            <default>
-                <Spacer
-                    latin:horizontalGap="8.042%p" />
-            </default>
         </switch>
         <Key
             latin:keyStyle="spaceKeyStyle"
-            latin:keyWidth="37.454%p" />
+            latin:keyXPos="31.250%p"
+            latin:keyWidth="37.500%p" />
         <switch>
             <case
                 latin:voiceKeyEnabled="true"
             >
                 <Key
-                    latin:keyStyle="micKeyStyle" />
+                    latin:keyStyle="micKeyStyle"
+                    latin:keyXPos="-8.047%p"
+                    latin:keyWidth="fillRight" />
             </case>
         </switch>
     </Row>