1<?xml version="1.0" encoding="utf-8"?> 2<!-- Copyright 2014 Google Inc. All Rights Reserved. --> 3<!-- 4This mess is all to draw a rectangle in the right place on the screen. 5Here's what's going on: 6 - Keyboard uses the intrinsic size of the drawable to work out where the drawable should be 7 centered in the key. 8 - Inset uses the intrinsic size of its inner drawable. This effectively scales the drawable 9 down to add padding, and doesn't make the drawable bigger. 10 - LayerList uses the maximum intrinsic size of its items as its intrinsic size. 11 - So, we use a LayerList with a blank shape that assumes the size of the keyboard key. 12 - We then add an inset with insetTop + insetBottom + inner shape = size of key. 13--> 14<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > 15 <item> 16 <shape> 17 <size 18 android:height="@dimen/keyboard_key_height" 19 android:width="@dimen/keyboard_key_spacebar_width" /> 20 <solid android:color="@color/ime_background_letters" /> 21 </shape> 22 </item> 23 <item> 24 <inset 25 android:insetTop="@dimen/keyboard_spacebar_pressed_margin" 26 android:insetBottom="@dimen/keyboard_spacebar_pressed_margin" 27 android:insetLeft="@dimen/keyboard_key_spacebar_visual_horizontal_padding" 28 android:insetRight="@dimen/keyboard_key_spacebar_visual_horizontal_padding" > 29 <shape 30 android:shape="rectangle"> 31 <size 32 android:height="@dimen/keyboard_spacebar_height" 33 android:width="@dimen/keyboard_key_spacebar_visual_width" /> 34 <corners 35 android:radius="@dimen/keyboard_spacebar_rounding" /> 36 <solid 37 android:color="@color/ime_foreground_spacebar_pressed" /> 38 </shape> 39 </inset> 40 </item> 41</layer-list>