如何在ListView中放置广告横幅

时间:2014-01-16 17:13:19

标签: android listview

我试图在每n行后在列表视图中返回横幅

我得到了它,但是当我向下滚动时,列表变得扭曲并且行开始重叠。广告横幅开始浮动列表。

public View getView(final int position, View convertView, ViewGroup parent) {
        View row = convertView;
        RestHolder holder = null;
        boolean showAd = proVersion == false
                && (position == 3 || (position % 6 == 0 && position != 0 && position != 6));
        if (showAd) {
            if (row instanceof Banner) {
                return row;
            } else {
                            //declared startAppBanner in the constructor
                return startAppBanner;
            }
        }
        if (row == null || row instanceof Banner) {
            System.err.println("### notusing row");
            LayoutInflater inflater = ((SherlockActivity) context)
                    .getLayoutInflater();
            row = inflater.inflate(viewResourceId, parent, false);
           ....

0 个答案:

没有答案