【问题标题】:QML elements over device's status bar设备状态栏上的 QML 元素
【发布时间】:2015-12-18 18:07:17
【问题描述】:

显示设备的键盘时遇到问题。元素在设备的状态栏上显示,如图所示。

我已经尝试使用Flickable 类型,但它不起作用。每次键盘出现时,它都会将应用元素推到状态栏上。

PS:Android 和 iOS 都会出现这个问题。

代码如下:

import QtQuick 2.4
import QtQuick.Window 2.2
import QtQuick.Controls 1.3

Window {
    visible: true
    property int larguraTela: 360
    property int alturaTela: 640
    width: larguraTela
    height: alturaTela
    maximumWidth: larguraTela
    maximumHeight: alturaTela
    minimumWidth: larguraTela
    minimumHeight: alturaTela
    title: "OverStatusBar"

    Rectangle{
        id: retangulo1

        width: parent.width
        height: parent.height * 0.5
        anchors.top: parent.top
        color: "grey"
    }

    Rectangle{
        id: retangulo2

        width: parent.width
        height: parent.height * 0.5
        anchors.top: retangulo1.bottom
        color: "lightgrey"

        TextField {
            id: campoTexto

            width: parent.width * 0.7
            height: parent.height * 0.15
            anchors.centerIn: parent
            inputMethodHints: Qt.ImhDigitsOnly
        }
    }
}

【问题讨论】:

    标签: android ios qml statusbar


    【解决方案1】:

    在Android上:你需要在activity标签的末尾添加android:windowSoftInputMode="adjustResize",所以它看起来像这样:

    <activity ... android:windowSoftInputMode="adjustResize">
    

    【讨论】:

      【解决方案2】:

      这种行为被 Qt 接受为错误。如果有人想跟上,这里是链接

      https://bugreports.qt.io/browse/QTBUG-50200

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-08-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-06-14
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多