Android 在java中添加textview

Android 在java中添加textview,android,layout,textview,Android,Layout,Textview,我在主要活动中有以下代码: if (T.ISHORIZONTAL) { // if(T.DISPLAY_WIDTH<480) adView = new AdView(this); adView.setAdSize(AdSize.SMART_BANNER); adView.setAdUnitId(getResources().getString( R.string.banner_ad_unit_i

我在主要活动中有以下代码:

if (T.ISHORIZONTAL) {
        // if(T.DISPLAY_WIDTH<480)
        adView = new AdView(this);
        adView.setAdSize(AdSize.SMART_BANNER);
        adView.setAdUnitId(getResources().getString(
                R.string.banner_ad_unit_id));
        // else
        // adView = new AdView(this, AdSize., "a150a0ece652e81");
        app = new App(context, null);
        FrameLayout layout = new FrameLayout(this);
        FrameLayout.LayoutParams gameParams = new FrameLayout.LayoutParams(
                FrameLayout.LayoutParams.FILL_PARENT,
                FrameLayout.LayoutParams.FILL_PARENT);
        adsParams = new FrameLayout.LayoutParams(
                FrameLayout.LayoutParams.WRAP_CONTENT,
                FrameLayout.LayoutParams.WRAP_CONTENT,
                android.view.Gravity.BOTTOM | android.view.Gravity.CENTER);
        if (T.DISPLAY_WIDTH < 380) {
            adsParams.setMargins(-70, 0, -70, 0);
        }
        layout.addView(app, gameParams);
        layout.addView(adView, adsParams);
        AdRequest adRequest = new AdRequest.Builder().build();
        adView.loadAd(adRequest);
        setContentView(layout);
    } else {

        setContentView(R.layout.main_lay);
        app = (App) findViewById(R.id.gameBoard1);
        adView = (AdView) findViewById(R.id.adView);
if(T.ISHORIZONTAL){
//如果(T.显示宽度使用


不行。我认为仅仅更改java代码就行了
   <?xml version="1.0" encoding="utf-8"?>
   <RelativeLayout xmlns:ads="http://schemas.android.com/apk/res-auto"
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent" >

<com.is.cut.App
    android:id="@+id/gameBoard1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/banner_ad_unit_id" >
</com.google.android.gms.ads.AdView>
<com.is.cut.App
    ...
    android:layout_above="@+id/adView"
    />