我使用赛贝尔曲线制作电子书,现在进度到随意的翻卷,想要加入书签功能。
public class MainActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
BookLayout bk = new BookLayout(this);
List<String> str = new ArrayList<String>();
try {
//电子书地址
InputStream in = getResources().openRawResource(R.raw.b);
BufferedReader br = new BufferedReader(new InputStreamReader(in,"utf-8"));
String line=null;
String strs="";
while((line=br.readLine())!=null){
int len = line.length();
strs = strs+line;
if(strs.length()<1024&&strs.length()>500){
str.add(strs);
strs="";
}
}
in.close();
} catch (Exception e) {
e.printStackTrace();
}
BookAdapter ba = new BookAdapter(this);
ba.addItem(str);
bk.setPageAdapter(ba);
setContentView(bk);
}