I have a problem with Google Adview ... it is not showing I have a dug for a while and seen That's where people have problems with padding, so I removed the padding and still did not make any luck.
Here is my relevant manifest data:
& lt; Activity Android: name = "com.google.ads.AdActivity" Android: configChanges = "keyboard | keyboardHidden | orientation" /> & Lt; Meta-Data Android: Value = "a14d91b10f12454" Android: name = "ADMOB_PUBLISHER_ID" /> & Lt; / Application & gt; & Lt; Use-permission Android: name = "android.permission.INTERNET" & gt; & Lt; / Usage-permission & gt; & Lt; Usage-permission Android: name = "android.permission.ACCESS_NETWORK_STATE" />
and my XML:
& lt; Relative layout xmlns: android = "http://schemas.android.com/ Apk / res / android" android: layout_height = "fill_parent" Android: Layout_width = "Fill_parent" android: background = "@ drawable / Gregreediant" & gt; & Lt; scrollview android: id = "@ + id / scrollView1" Android: layout_height = "fill_parent" Android: layout_width = "fill_parent" Android: layout_above = "@ + id / linearLayout2" android: padding = "15dp" & gt; & Lt; LinearLayout Android: layout_width = "fill_parent" Android: layout_height = "wrap_content" android: orientation = "vertical" & gt; & Lt; LinearLayout android: orientation = "horizontal" android: Layout_height = "Wrap_content" Android: Layout_width = "Fill_parent" android: padding = "5dp" & gt; & Lt; ImageView Android: src = "@ drawable / icon" Android: layout_height = "wrap_content" Android: layout_width = "wrap_content" android: id = "@ + id / imageviewdetail" & gt; & Lt; / ImageView & gt; & Lt; TextView android: text = "TextView" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_gravity = "center_vertical" Android: layout_marginLeft = "5dp" android: id = "@ + id / textviewdetailname" Android: textSize = "18dp" & gt; & Lt; / TextView & gt; & Lt; / LinearLayout & gt; & Lt ;! - Snip - & gt; & Lt; / LinearLayout & gt; & Lt; / Scrollview & gt; & Lt; LinearLayout android: id = "@ + id / linearLayout2" Android: Layout_height = "Wrap_content" Android: Layout_width = "Fill_parent" Android: layout_alignParentBottom = "true" android: orientation = "vertical" & gt; & Lt; Button Android: layout_height = "wrap_content" Android: layout_width = "fill_parent" android: text = "sign up!" Android: Android: Android: Android: Leaut_margin = "15 DP" android: id = "@ + id / Btntensubmit" Android: Leaut_mrjintop = "10 DP" & gt; & Lt; / Button & gt; & Lt; Com.google.ads.AdView android: id = "@ + id / Googleads" Android: layout_width = "fill_parent" android: layout_height = "wrap_content" & gt; & Lt; /com.google.ads.adview> & Lt; / LinearLayout & gt;
And finally, the ad running is:
AdView ad = (AdView) findViewById (R.id .googleads); Ad.setEnabled (true); Ad = New AdView (this, AdSize.BANNER, "a14d91b10f12454"); AdRequest r = new AdRequest (); R.setTesting (true); Ad.loadAd (R); In my logcat, it shows that I am receiving the ad and you can see in the AdMob Administrator panel that successful requests have been made .. but I'm really stupid to show Can not get the view!
Does anybody help?
You are not adding an AdView to your layout when you create a new ad view
ad = new AdView this, AdSize.BANNER, "a14d91b10f12454"); You should remove the AdView from the XML and do so.
LinearLayout parent = (LinearLayout) findViewById (R.id.linearLayout2); AdView Ad = New AdView (this, AdSize.BANNER, "a14d91b10f12454"); Parent.addView (Advertisement); AdRequest r = new AdRequest (); R.setTesting (true); Ad.loadAd (R);
Comments
Post a Comment