1

我在我的活动 pageIndicatorActivity 中实现 Flipboard 动画,它显示错误,即 FlipViewController 类型中的方法 Page(NoteViewAdapter) 不适用于参数 (PageIndicatorActivity.NoteViewAdapter)

这是我面临的错误

这是我的代码

package com.horizontalscrollviewwithpageindicator;

import java.util.ArrayList;

import com.aphidmobile.flip.FlipViewController;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class PageIndicatorActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ViewPagerAdapter adapter = new ViewPagerAdapter(this, imageArra);
        ViewPager myPager = (ViewPager) findViewById(R.id.myfivepanelpager);
        myPager.setAdapter(adapter);
        myPager.setCurrentItem(0);

         ArrayList<String> notes = new ArrayList<String>();
            notes.add("Come");
            notes.add("On");
            notes.add("Flip");
            notes.add("Me");

            //You can also use FlipViewController.VERTICAL
            FlipViewController flipView = new FlipViewController(this, FlipViewController.HORIZONTAL);

            //We're creating a NoteViewAdapter instance, by passing in the current context and the
            //values to display after each flip
            flipView.Page(new NoteViewAdapter(this, notes));

            setContentView(flipView);

    }

    public abstract class NoteViewAdapter extends BaseAdapter {
        private LayoutInflater inflater;        
        private ArrayList<String> notes;

        public NoteViewAdapter(Context currentContext, ArrayList<String> allNotes) {
            inflater = LayoutInflater.from(currentContext);        
            notes = allNotes;
        }

        @Override
        public int getCount() {
            return notes.size();
        }

        @Override
        public Object getItem(int position) {
            return position;
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View layout = convertView;

            if (convertView == null) {
                layout = inflater.inflate(R.layout.activity_main, null);
            }            

            //Get's value from our ArrayList by the position
            String note = notes.get(position);

            TextView tView = (TextView) layout.findViewById(R.id.note);

            tView.setText(note);
            return layout;
        }
    }
    private int imageArra[] = { R.drawable.antartica1, R.drawable.antartica2,
            R.drawable.antartica3, R.drawable.antartica4,
            R.drawable.antartica5, R.drawable.antartica6,
            R.drawable.antartica7, R.drawable.antartica8 };

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

}
4

0 回答 0