如何改变一行中某些键的高度?
我正在创建自定义键盘布局。 SDK 允许更改一行中按键的宽度(如在 ThickButtons 中),但理想情况下,我希望能够改变一行中按键的高度和宽度(并且仍然让按键占据所有可用空间。 )
另一种看待这个问题的方式是,我希望允许某些键位于多个连续行中。任何想法都会有帮助。谢谢。
I'm creating a custom keyboard layout. The SDK allows changing the width of keys in a row (as in ThickButtons), but ideally I'd like to be able to vary both the height and width of keys within a row (and still have the keys occupy all the available space.)
Another way of looking at this is that I want to allow some keys to be in more than one contiguous row. Any ideas would help. Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所有键的“宽度”和“高度”都是最小键宽度/高度的倍数吗?如果是这样,您可以嵌套水平和垂直 LinearLayouts 根据需要描述键盘,使用layout_weight 来制作双倍宽或双高键。
例如,如果我查看工作站的键盘,它本质上是一个 5x4 的按键网格,最右侧的列中有一个双高的“+”和“enter”键,底部有一个双宽的 0 - 左侧位置(相当标准的配置,请在本说明中参考您自己的配置)。我可以为 0 {numlock,7,4,1} 和 {/,8,5,2}“顶部”的每一列进行垂直线性布局。接下来可以将它们放入水平线性布局中以对所有 8 个键进行分组。该组件可以与另一种垂直布局中的“0”按钮组合,权重“4”分配给8键组件,“1”分配给0键。我们将这个完整的 9 键组件称为 A。现在您可以为 {*,9,6,3} 和 {-,+,enter} 制作垂直线性布局。在第二个中,为每个 + 和 Enter 键赋予权重 2。最后使用水平线性布局将组件 A 与其他 2 个垂直布局分组。
Will all key "widths" and "heights" be a multiple of the smallest key width/height? If so, you can nest horizontal and vertical LinearLayouts as necessary to describe the keyboard, using layout_weight to make your double-wide or double-high keys.
For example, if I look at the keypad to my workstation, it is essentially a 5x4 grid of keys, with a double-high "+" and "enter" key in the right-most column and a double-wide 0 in the bottom-left position (fairly standard configuration, refer to your own in this description). I can make vertical linear layouts for each of the columns "on top of" the 0 {numlock,7,4,1} and {/,8,5,2}. These can next be put into a horizontal linear layout to group all 8 keys. This assembly can be combined with the "0" button in another vertical layout, with weight "4" to the 8 key assembly and "1" to the 0 key. Let's call this full assembly of 9 keys assembly A. Now you can make vertical linear layouts for {*,9,6,3} and {-,+,enter}. In the second of these, give weightings of 2 to each of the + and enter key. Finally use a horizontal linear layout to group assembly A with each of the other 2 vertical layouts.