Search code examples
androidadmobandroid-linearlayoutandroid-relativelayout

How to use Admob ad in LinearLayout?


Hello I have made an app that has 17 activities made with Linearlayout . I did not know anything about Admob or how to use in android project so I made my project with LinearLayout. After some tutorials and YouTube videos I could not find out how to use ads with Linearlayout. Everybody is changing their layout to RelativeLayout. How can I add advertisements in my app.

Every layout file contains scroll view and other LinearLayout layout nested.

Advanced Thank You


Solution

  • from the way you described it, I suppose you're using Banners, if not then you don't need to alter your layout because all the other ad types are add by code in java. Regarding banner ads you can put your linearLayout insead of a constraintLayout and then you can add the BannerAd above your linearLayout, that way you won't have to change the layout very much.