我已尝试过所有内容(admob教程,GitHub克隆,youtube教程等)。它不会在任何设备(手机或平板电脑)上显示,也不会在模拟器上显示。如果有人能给我一些方向,我将不胜感激。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:ads="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:orientation="vertical"> <FrameLayout
android:layout_width="match_parent"
android:layout_height="192dp"
android:background="@drawable/listback1"
android:alpha="0.8"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingLeft="16dp"
android:paddingBottom="5dp"
android:gravity="right"
android:textColor="@color/orange"
style="@style/TextAppearance.AppCompat.Title"
android:text="Food For Thought"
android:elegantTextHeight="true"
/> </FrameLayout>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/textsign"
android:id="@+id/toolbar"
app:menu="@menu/menu_main"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:title="Choose Your Dining Experiance"/>
<ExpandableListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/expandableListView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:divider="@color/orange"
android:textColor="#000000"
android:dividerHeight="1dp"
android:layout_marginTop="20dp" />
<com.google.android.gms.ads.AdView
android:id="@+id/ad_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:paddingTop="15dp"
ads:adSize="BANNER"
android:layout_below="@id/expandableListView"
android:layout_weight="1"
ads:adUnitId="@string/banner_ad_unit_id" />
</LinearLayout>
活性
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.expandable_layout);
AdView mAdView = (AdView) findViewById(R.id.ad_view);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);}
gradle这个
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
android manifest:
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|ui
Mode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
答案 0 :(得分:0)
更改ExpandableListView
.container {
background: rgba(255,255,255,0.1);
}