简体   繁体   English

Android自定义键盘:更改候选高度

[英]Android custom keyboard: change candidate height

I'm writing a custom keyboard and I want to use the candidate. 我正在编写自定义键盘,并且想使用候选键盘。 But the candidate view is set to a certin height which is to small for my needs. 但是,将候选视图设置为可满足我的需要的高度。 I cant seem to set the height of the candidate. 我似乎无法设定候选人的身高。 if I set the height to certine dp i get half black screen. 如果我将高度设置为certine dp,我会得到半黑屏。

Thank you! 谢谢!

The height of the Android Custom Keyboard candidate view could be chang from CandidateView.java file. Android自定义键盘候选视图的高度可以从CandidateView.java文件更改。 Open the file and find the below line: 打开文件并找到以下行:

final int desiredHeight = ((int) mPaint.getTextSize()) + mVerticalPadding
                + padding.top + padding.bottom;

And add number with it as follow: 并添加数字,如下所示:

final int desiredHeight = ((int) mPaint.getTextSize()) + mVerticalPadding
                + padding.top + padding.bottom + 20;

The 20 at the end of code line increases the height of candidate view. 代码行末尾的20增加了候选视图的高度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM