0

画像の配列リストとスクロールビューの下のテキストフィールドを含む水平スクロールビューがあります。水平スクロールビューで画像を変更するときにテキストを変更するにはどうすればよいですか。

For Example: If the image will show image2 the text will also texted with text2 next when i will scroll the image2 to image3 the text will also move from text2 to text3

ここで、画像はスクロールするだけで、テキストビューは修正されたままになり、画像のみで名前が変更されます

私はあらゆる可能性を試しましたが、得られませんでした:

ここでは、画像を配置したビュー項目でアダプター クラスを使用しました。

public View getView(int position, View convertView, ViewGroup parent) {


            vi=convertView;


            if(convertView==null){
                vi = LayoutInflater.from(parent.getContext()).inflate(R.layout.screen, null);

               position_pin = position;

              Holder.images=(ImageView) vi.findViewById(R.id.image);
              Holder.textview=(TextView) vi.findViewById(R.id.name);



             Holder.images.setImageResource(imageIds[position]);
           Holder.text.setText(name);//here name is String 

             vi.setTag(Holder);   

            }

                        return vi;
            }
4

2 に答える 2

0

タイトルページャーインジケーターをビューページャーと統合するだけです。

  ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
ImagePagerAdapter adapter = new ImagePagerAdapter();
viewPager.setAdapter(adapter);
TitlePageIndicator titleIndicator = (TitlePageIndicator)findViewById(R.id.titles);
titleIndicator.setViewPager(viewPager);

タイトルページャーインジケーターのライブラリプロジェクトは、 https://github.com/JakeWharton/Android-ViewPagerIndicatorにあります。

于 2013-03-22T06:25:40.493 に答える
0

スクロール ビュー リスナーを実装し、テキストを表示できる位置に基づいて位置を取得します。

ExampleScrollView exampleScrollView = (ExampleScrollView) findViewById(R.id.example_scroll_view);

exampleScrollView.setOnScrollViewListener( new OnScrollViewListener() {

public void onScrollChanged( ExampleScrollView v, int l, int t, int oldl, int oldt ) { 
    Log.d( "Scroller", "I changed!" ); 
} 

} );

于 2013-03-22T06:09:46.103 に答える