Use SMART_BANNER in Admob

This commit is contained in:
serso 2017-08-02 11:29:12 +02:00
parent 980b0f944a
commit da98947dab

View File

@ -1,10 +1,14 @@
package org.solovyev.android.calculator;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import android.content.Context;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
@ -12,9 +16,6 @@ import com.google.android.gms.ads.AdSize;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
public class AdView extends FrameLayout {
@Nullable
@ -92,7 +93,7 @@ public class AdView extends FrameLayout {
private com.google.android.gms.ads.AdView addAdmobView() {
final com.google.android.gms.ads.AdView v = new com.google.android.gms.ads.AdView(getContext());
v.setVisibility(GONE);
v.setAdSize(AdSize.BANNER);
v.setAdSize(AdSize.SMART_BANNER);
v.setAdUnitId(getResources().getString(R.string.admob));
final LayoutParams lp = new LayoutParams(MATCH_PARENT, WRAP_CONTENT);
lp.gravity = Gravity.CENTER;