Important: Please read the Qt Code of Conduct -

QtActivity and LinearLayout

  • Hello,

    Is it possible in a subclassed QtActivity (onCreate) to add LinearLayout to have top small part with android ui and bottom large part with QML?

    At the moment I set padding to QML view with
    ViewGroup viewGroup = (ViewGroup) getWindow().getDecorView().getRootView();
    View view = viewGroup.getChildAt(0); //QML view
    view.setPadding(0, 150, 0, 0);
    and then add new andoid view to the top:
    ViewGroup.LayoutParams ad_layout_params = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, 150);
    //mAdView is admob View created elsewhere
    viewGroup.addView( mAdView);

    Why I want LinearLayout? Because with pixel height (150) on different devices I get either halfview ads or too much height ads.

    So can I provide my own layout.xml to QtActivity and if I can, what should be there regarding QML view?

    Or maybe there is a way to add smth like
    LinearLayout layout = new LinearLayout(this);
    layout.addView(adView);// ads
    layout.addView(?????);// QML view

  • Hello !
    Could you tell us about your solution if you found it ? I've been looking for any way to position a banner on the screen. Is it possible to put it at the bottom of the screen ? Maybe someone knows how to do that. Thank you.

Log in to reply