1
アンドロイド
にViewPagerコレクションに追加するには、どのように私はこのURLにそれがTextViewのと連動し、ここでhttp://android-developers.blogspot.in/2011/08/horizontal-view-swiping-with-viewpager.htmlビットマップにIMAGEURLをロードすると
を追いました。
TextView tv = new TextView(cxt);
tv.setText("Bonjour PAUG " + position);
tv.setTextColor(Color.WHITE);
tv.setTextSize(30);
((ViewPager) collection).addView(tv,0);
return tv;
........................................... ...................
しかし、私はimageURLsの設定していると、私はビットマップにそれをロードする必要があり、その後、私はViewPagerにこれを追加する必要があります... ..何か案は!!!
public Object instantiateItem(View collection, int position)
{
LayoutInflater inflater = (LayoutInflater) collection.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
int resId = 0;
try
{
String saveimg= urls[position];
String url1 = saveimg ;
URL ulrn = new URL(url1);
HttpURLConnection con = (HttpURLConnection)ulrn.openConnection();
InputStream is = con.getInputStream();
Bitmap bmp = BitmapFactory.decodeStream(is);
if (null != bmp)
{
ImageView Imgview=new ImageView(cxt);
Imgview.setImageBitmap(bmp);
((ViewPager) collection).addView(Imgview, 0);
int i=0;
return Imgview;
}
else
System.out.println("The Bitmap is NULL");
}
catch(Exception e)
{
int i=0;
}
こんにちは、あなたはあなたのソリューションを提供する必要があり –
私の問題を解決しまし示唆? markov00 @おかげ – markov00
:あなたが知っておくべきこと –