Android 在ActionBar上获取admob Sherlock

Android 在ActionBar上获取admob Sherlock,android,admob,actionbarsherlock,Android,Admob,Actionbarsherlock,我想在同一个android应用程序中使用AdMob和ActionBarSherlock,但我无法将AdMob放在屏幕顶部(Sherlock ActionBar上方) 有人有类似的问题吗?有人知道一些变通方法吗 谢谢 我的总体布局: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="

我想在同一个android应用程序中使用AdMob和ActionBarSherlock,但我无法将AdMob放在屏幕顶部(Sherlock ActionBar上方)

有人有类似的问题吗?有人知道一些变通方法吗

谢谢

我的总体布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > 
<include layout="@layout/admob"/> 
<TabHost
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:id="@android:id/tabhost"
 android:layout_width="match_parent"
 android:layout_height="match_parent">
 <LinearLayout.....


我使用ActionBarSherlock作为包装器,下面将广告置于操作栏上方:

private ActionBarSherlock sherlock = ActionBarSherlock.wrap(this);

@Override
public void onCreate(Bundle savedInstanceState)
{
    /* ... set up layout here ... */


    adView = new AdView(this, AdSize.BANNER, "deadbeefmeat");

    ViewParent parentView = appView.getParent();
    do
    {
        parentView = parentView.getParent();
    } while(!(parentView instanceof LinearLayout));

    ((LinearLayout)parentView).addView(adView, 0);

    AdRequest adRequest = new AdRequest();
    adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
    adView.loadAd(adRequest);
}

// All setContentView methods are overridden because ActionBarSherlock has to modify the view
@Override
public void setContentView(int layoutResID)
{
    // Don't call super!
    sherlock.setContentView(layoutResID);
}

@Override
public void setContentView(View view)
{
    // Don't call super!
    sherlock.setContentView(view);
}

@Override
public void setContentView(View view, LayoutParams params)
{
    // Don't call super!
    sherlock.setContentView(view, params);
}

我还没有找到一种方法,它如何与内置Android ActionBar一起工作。你知道路吗?这可能是android ActionBar的一个问题:
private ActionBarSherlock sherlock = ActionBarSherlock.wrap(this);

@Override
public void onCreate(Bundle savedInstanceState)
{
    /* ... set up layout here ... */


    adView = new AdView(this, AdSize.BANNER, "deadbeefmeat");

    ViewParent parentView = appView.getParent();
    do
    {
        parentView = parentView.getParent();
    } while(!(parentView instanceof LinearLayout));

    ((LinearLayout)parentView).addView(adView, 0);

    AdRequest adRequest = new AdRequest();
    adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
    adView.loadAd(adRequest);
}

// All setContentView methods are overridden because ActionBarSherlock has to modify the view
@Override
public void setContentView(int layoutResID)
{
    // Don't call super!
    sherlock.setContentView(layoutResID);
}

@Override
public void setContentView(View view)
{
    // Don't call super!
    sherlock.setContentView(view);
}

@Override
public void setContentView(View view, LayoutParams params)
{
    // Don't call super!
    sherlock.setContentView(view, params);
}