我有一个包含7张幻灯片的viewpager。但幻灯片的内容是HTML,所以我想在启动画面中加载HTML的数据,之后我想显示内容。我的内容在我的活动的instantiateItem方法中得到了膨胀。
@Override
public Object instantiateItem(ViewGroup container, int position) {
layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
HTMLPre preparer = new HTMLPre();
String font = "SourceSansPro-Regular";
View one = layoutInflater.inflate(R.layout.slide_type_a, container, false);
WebView header_1_a = (WebView) one.findViewById(R.id.header_slide_type_a_1);
preparer.loadHTLMContentHeader(getString(R.string.Aktien1_header),header_1_a,font);
ImageView image_1_a = (ImageView) one.findViewById(R.id.image_slide_type_a_1);
image_1_a.setImageResource(R.drawable.picture_kap01_01);
WebView text_1_a = (WebView) one.findViewById(R.id.text_slide_type_a_1);
preparer.loadHTLMContentText(getString(R.string.Aktien1), text_1_a,font);
View two = layoutInflater.inflate(R.layout.slide_type_a, container, false);
header_1_a = (WebView) two.findViewById(R.id.header_slide_type_a_1);
preparer.loadHTLMContentHeader(getString(R.string.Aktien2_header),header_1_a,font);
image_1_a = (ImageView) two.findViewById(R.id.image_slide_type_a_1);
image_1_a.setImageResource(R.drawable.picture_kap01_01);
text_1_a = (WebView) two.findViewById(R.id.text_slide_type_a_1);
preparer.loadHTLMContentText(getString(R.string.Aktien2), text_1_a,font);
View three = layoutInflater.inflate(R.layout.slide_type_a, container, false);
header_1_a = (WebView) three.findViewById(R.id.header_slide_type_a_1);
preparer.loadHTLMContentHeader(getString(R.string.Aktien3_header), header_1_a,font);
image_1_a = (ImageView) three.findViewById(R.id.image_slide_type_a_1);
image_1_a.setImageResource(R.drawable.boerse_antwerpen);
text_1_a = (WebView) three.findViewById(R.id.text_slide_type_a_1);
preparer.loadHTLMContentText(getString(R.string.Aktien3), text_1_a,font);
View four = layoutInflater.inflate(R.layout.slide_type_a, container, false);
header_1_a = (WebView) four.findViewById(R.id.header_slide_type_a_1);
preparer.loadHTLMContentHeader(getString(R.string.Aktien4_header), header_1_a,font);
image_1_a = (ImageView) four.findViewById(R.id.image_slide_type_a_1);
image_1_a.setImageResource(R.drawable.parketthandel);
text_1_a = (WebView) four.findViewById(R.id.text_slide_type_a_1);
preparer.loadHTLMContentText(getString(R.string.Aktien4), text_1_a,font);
View five = layoutInflater.inflate(R.layout.slide_type_c, container, false);
image_1_a = (ImageView) five.findViewById(R.id.image_slide_type_c_1);
image_1_a.setImageResource(R.drawable.parketthandel);
text_1_a = (WebView) five.findViewById(R.id.text_slide_type_c_1);
preparer.loadHTLMContentText(getString(R.string.Aktien5), text_1_a,font);
View six = layoutInflater.inflate(R.layout.slide_type_c, container, false);
image_1_a = (ImageView) six.findViewById(R.id.image_slide_type_c_1);
image_1_a.setImageResource(R.drawable.parketthandel);
text_1_a = (WebView) six.findViewById(R.id.text_slide_type_c_1);
preparer.loadHTLMContentText(getString(R.string.Aktien6), text_1_a,font);
View seven = layoutInflater.inflate(R.layout.slide_type_c, container, false);
image_1_a = (ImageView) seven.findViewById(R.id.image_slide_type_c_1);
image_1_a.setImageResource(R.drawable.parketthandel);
text_1_a = (WebView) seven.findViewById(R.id.text_slide_type_c_1);
preparer.loadHTLMContentText(getString(R.string.Aktien7), text_1_a,font);
View eigth = layoutInflater.inflate(R.layout.slide_type_c, container, false);
image_1_a = (ImageView) eigth.findViewById(R.id.image_slide_type_c_1);
image_1_a.setImageResource(R.drawable.seewegevoc);
text_1_a = (WebView) eigth.findViewById(R.id.text_slide_type_c_1);
preparer.loadHTLMContentText(getString(R.string.Aktien8), text_1_a,font);
View nine = layoutInflater.inflate(R.layout.startquiz_layout, container, false);
View viewarr[] = {one, two, three, four, five, six, seven, eigth, nine};
container.addView(viewarr[position]);
return viewarr[position];
}
所以现在我想在加载启动画面时加载在此激活中完成的操作。有人有任何想法吗?