简体   繁体   中英

How to hide MobClix adview while the ad is not filled?

This is my first question on SO so please be gentle.

My layout basically looks like below. What i want to do is: hide the MobclixMMABannerXLAdView while the ad is not filled. Is this possible with an linear layout like this? can this be done with small changes in code?

My idea was to implement the MobclixAdListener and set View.GONE but it seems there has to be a shorter way.

So my question is: is there a shorter way?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:windowSoftInputMode="stateHidden"
android:focusable="true" android:focusableInTouchMode="true"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:id="@+id/mainLayout">
<com.mobclix.android.sdk.MobclixMMABannerXLAdView android:id="@+id/banner_adview" android:layout_height="wrap_content" android:layout_width="320dp"></com.mobclix.android.sdk.MobclixMMABannerXLAdView>
<ScrollView android:id="@+id/ScrollView01"
    android:layout_width="fill_parent" android:layout_height="wrap_content">
</ScrollView>

I had the same problem. In my case I did implemented the MobclixAdViewListener:

@Override
public void onSuccessfulLoad(MobclixAdView view) {
    Logger.verbose(LOG_TAG, "The ad request was successful!");
    adView.setVisibility(View.VISIBLE);
}

@Override
public void onFailedLoad(MobclixAdView view, int errorCode) {
    Logger.verbose(LOG_TAG, "The ad request failed with error code: " + errorCode);
    adView.setVisibility(View.GONE);
}

One other thing my view starts GONE and when I have an ad I will show the view and when I don't have an ad I hide the view

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM