In your xml add your view class like
Let's name it myLayout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<package.MyActivity$ViewClass android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="MY_AD_UNIT_ID"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
ads:loadAdOnCreate="true"/>
<LinearLayout/>
@Override
onCreate()
{
setContentView(R.layout.myLayout);
myView= (ViewClass)findViewById(R.id.viewClass);
}
More information on creating a view class.