在花式封面流程中获得错误的位置

时间:2015-03-18 14:06:06

标签: android android-layout position coverflow

我在Fancy cover flow上有关于项目点击监听器的代码。但我在点击事件上的位置错误。请帮我解决一下。 我也尝试过使用On Item Selected Listener。它不起作用。

activity.java

// spinner
        fancy.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int i, long arg3) {
                // TODO Auto-generated method stub

                Log.d("clicked_position",i);

                //Whenever I click, sometimes I get wrong Position, sometimes correct position.

            }

        });

1 个答案:

答案 0 :(得分:0)

fancyCoverFlow
                        .setOnItemSelectedListener(new OnItemSelectedListener() {

                            @Override
                            public void onItemSelected(AdapterView<?> parent,
                                    View view, int position, long id) {

                                Log.e(getPackageName(), "position:- "
                                        + position);

                            }

                            @Override
                            public void onNothingSelected(AdapterView<?> arg0) {
                                // TODO Auto-generated method stub

                            }
                        });