resolution in android



  • I am developing an application in qt and I came across the following problem: when giving run or build and run the application in android I noticed that the buttons, combobox and other components are appearing in the cell asymmetrically, I wonder if there is how to solve, and do for various resolutions ???


  • Moderators

    A screenshot would be helpful, and some code, then we can diagnose better.

    Are you using QtQuick Controls 1 or 2? Are you using layouts? Are you using custom fonts?

    Does it also look asymmetrical when you build for desktop?



  • 1_1525188873304_Capturar.JPG 0_1525188873304_01.JPG

    in desktop1_1525188948746_Capturar.JPG 0_1525188948746_01.JPG 0_1525188963218_01.JPG 0_1525189008014_01.JPG 0_1525189018476_01.JPG



  • 0_1525189670968_teste.JPG in abdroid, emulator memu


  • Moderators

    @Joao-Alysson Do you use layouts?


  • Moderators

    So the problem is that these labels (Kc1, Kc2 etc.) should be centered above the input fields, right?

    That indeed might be (slightly) dependent on resolution and (much more) on the font. But still, it should be possible to center them pretty nicely. Are you using QtWidgets or QtQuick for your UI?

    If QtQuick, then try something like this:

    ColumnLayout {
      Text { // Or Label
        text: "Kc1"
        horizontalAlignment: Text.AlignHCenter
        Layout.alignment: Qt.AlignHCenter
      }
      TextInput {
        // ...
      }
    }
    


  • @sierdzio i like in yhe android im using qt creator is an app query, you change the parameters example: avocado, play the parameters in the textlist, just wanted to be adaptable, on my phone and a lg k4 and works on the screen all the same in the first image, already in the emulator memu, he cut the parameters, do not display everything!


  • Moderators

    Oh you mean that you don't see the button etc. So this is not about being centered at all.

    There are many ways to fix this issue (I still don't know if you are using widgets or qml, I'm assuming QML even though I suspect otherwise):

    • place your UI inside a Flickable component, to allow users to scroll your UI on smaller screens
    • make sure your app is run in fullscreen mode and that your layout (you are using layouts, right?) does not exceed the window size
    • set smaller minimal / preferred sizes for your components so that they fit on smaller screens
    • if the UI does not fit, hide some components, or move them to next page or something


  • @sierdzio I use c ++, it's just that in a resolution it gets full in another cut wanted to be able to screen


  • Moderators

    No this is not (only) about resolution. If you build the UI in a responsive way, it will fit any (reasonable) screen size and resolution.

    So, if you're using widgets, try meddling with size policy and making a tighter layout. There is plenty of unused screen estate in your Android screenshot.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.