开发者

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

开发者 https://www.devze.com 2023-04-06 02:47 出处:网络
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.

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">
&l开发者_运维问答t;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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号