Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QtActivity and LinearLayout
Qt 6.11 is out! See what's new in the release blog

QtActivity and LinearLayout

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 2 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    habamax
    wrote on last edited by
    #1

    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
    mAdView.setLayoutParams(ad_layout_params);
    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
    @
    onCreate(){...
    LinearLayout layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.addView(adView);// ads
    layout.addView(?????);// QML view
    setContentView(layout);
    }
    @

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Anatoly
      wrote on last edited by Anatoly
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved