【问题标题】:Can I place GridLayout in KeyboardView?我可以在 KeyboardView 中放置 GridLayout 吗?
【发布时间】:2015-10-29 16:17:35
【问题描述】:

有没有办法在 Android 的 KeyboardView 中使用带有一些图片的 GridLayout?我试图用 xml 编写它,但它给了我错误,我不能在 KeyboardView 中拥有该元素。

【问题讨论】:

    标签: android xml android-softkeyboard grid-layout ime


    【解决方案1】:

    那你为什么用KeyboardView呢?

    创建一个InputMethodService 并在onCreateInputView() 中返回您想要显示的任何布局。

    @Override
    public View onCreateInputView() {
            final View root = getLayoutInflater().inflate(R.layout.keyboard_layout, null);         
    
             //set all the click listeners for your views
    
            return root;
    }
    

    【讨论】:

    • 我试图将表情符号放在gridview中,但后来我在keyboardview中添加了那些。现在有表情符号键,但我必须修复编码错误,因为当用户点击表情符号键时,它会打印一些中文字母。你知道我应该怎么做才能解决这个问题吗?
    猜你喜欢
    • 2018-03-10
    • 1970-01-01
    • 2018-07-22
    • 2022-01-15
    • 2011-11-02
    • 2012-04-17
    • 2014-11-22
    • 1970-01-01
    • 2018-07-07
    相关资源
    最近更新 更多