mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2025-06-27 05:02:00 +02:00
Add <row scale=""> attribute
Scale the width of the keys in the row to match a value. Useful to remove space on the right of the row without adding a 'width' attribute to each key.
This commit is contained in:
parent
f9b844e988
commit
82b8568310
@ -52,9 +52,11 @@ The `<keyboard>`...`</keyboard>` pair follows the declaration tag and encloses t
|
|||||||
* `locale_extra_keys`: Whether Unexpected should add language-dependent extra keys from [method.xml](../res/xml/method.xml) to this layout. It accepts `true` or `false`, and defaults to `true`. To disable these automatic additions, specify `locale_extra_keys="false"`.
|
* `locale_extra_keys`: Whether Unexpected should add language-dependent extra keys from [method.xml](../res/xml/method.xml) to this layout. It accepts `true` or `false`, and defaults to `true`. To disable these automatic additions, specify `locale_extra_keys="false"`.
|
||||||
|
|
||||||
## Row
|
## Row
|
||||||
The `<row>`...`</row>` pair encloses one row on the keyboard. It has only one optional property:
|
The `<row>`...`</row>` pair encloses one row on the keyboard. It has the following optional property:
|
||||||
* `height`: The height of the row: a positive floating-point value.
|
* `height`: The height of the row: a positive floating-point value.
|
||||||
|
|
||||||
|
* `scale`: A positive floating-point value. If present, scale the width of each key so that the total is equal to the specified value, in key width unit.
|
||||||
|
|
||||||
A row's default height is 1.0 (one quarter of the keyboard height specified on the Settings menu). The `height` property makes the row taller or shorter than this. For example, if you define a 5-row keyboard but one row has `height="0.7"`, then the keyboard's total height is 4.7 units. If the total is different from 4.0, the keyboard will be taller or shorter than that specified in Settings.
|
A row's default height is 1.0 (one quarter of the keyboard height specified on the Settings menu). The `height` property makes the row taller or shorter than this. For example, if you define a 5-row keyboard but one row has `height="0.7"`, then the keyboard's total height is 4.7 units. If the total is different from 4.0, the keyboard will be taller or shorter than that specified in Settings.
|
||||||
|
|
||||||
## Key
|
## Key
|
||||||
|
@ -336,9 +336,13 @@ public final class KeyboardData
|
|||||||
int status;
|
int status;
|
||||||
float h = attribute_float(parser, "height", 1f);
|
float h = attribute_float(parser, "height", 1f);
|
||||||
float shift = attribute_float(parser, "shift", 0f);
|
float shift = attribute_float(parser, "shift", 0f);
|
||||||
|
float scale = attribute_float(parser, "scale", 0f);
|
||||||
while (expect_tag(parser, "key"))
|
while (expect_tag(parser, "key"))
|
||||||
keys.add(Key.parse(parser));
|
keys.add(Key.parse(parser));
|
||||||
return new Row(keys, h, shift);
|
Row row = new Row(keys, h, shift);
|
||||||
|
if (scale > 0f)
|
||||||
|
row = row.updateWidth(scale);
|
||||||
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Row copy()
|
public Row copy()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user