1
I want to put the advertisement in the footer of Activity, but it is at the top by superimposing a list:
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:listSelector="#4DA6FF"
android:background="#FFF"/>
<LinearLayout
android:id="@+id/listaPropaganda"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
Java, on Activity’s oncreate:
AdView ads = new AdView(this);
ads.setAdUnitId(ANUNCIO_ID);
ads.setAdSize(com.google.android.gms.ads.AdSize.BANNER);
LinearLayout layout = (LinearLayout) findViewById(R.id.listaPropaganda);
layout.addView(ads);
AdRequest request = new AdRequest.Builder().addTestDevice("1100").build();
ads.loadAd(request);
I want to put in the footer and filling all the space. How to do this?
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:listSelector="#4DA6FF"
android:background="#FFF"/>
<LinearLayout
android:id="@+id/listaPropaganda"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
It didn’t work, it made the Drawer menu disappear, follows the original code, in the first disappeared Drawer:
– Thiago Porto
Try to put the
layout_gravity="start"
in theLinearLayout
of id "container", theMenuDrawer
need to have agravity
.– Wakim
Wakim’s tip was of fundamental importance, and I had to put my list outside of linearlayout, thanks for the help
– Thiago Porto