2

friends i need your help.Actually i have to show a circle navigation of pages below listview.I have a dynamic listview and i have to show only 10 items of listview in one page.If listview has more than 10 items then it will show the no. of pages according to number of items in the listview.Suppose i have 50 items in listview then it will show 5 pages and below listview will be drawn 5 circle.click on these circles you will navigate from one page to another.I have to implement it.Is anyone have idea about this then please help me.

I am able to divide the number of items in listview.I am doing navigation through next and prev button.But now i need to show this through navigation of circles.Please help me.ANd view i want like this.I have to remove prev and next button.Current time i am doing my next prev click events.

nikki
  • 3,248
  • 3
  • 24
  • 29

1 Answers1

0

for achieving it you should take Relative layout in this layout you take a Liner layout at the bottom of this layout. And add images of circle at run time. using loop if you have 50 item in the list the divide it by 10 you got 5 run a loop 5 time and add a same imageview with different id in linerlayout with click listener. Like it..

                            for (int i = 0; i <   mResponseVector.size(); i++) {
                                LayoutInflater inflater = (LayoutInflater) QuestionDetailActivity.this
                                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                                View parent = (View) inflater.inflate(
                                        R.layout.answerlist_row, null);
                                ((TextView) parent.findViewById(R.id.ivAnswerFirstLine)).setText(Html.fromHtml(((SoapObject)mResponseVector.get(i)).getProperty("answer").toString()));
                                ((TextView) parent.findViewById(R.id.tvAnswerGiverName)).setText(Html.fromHtml(((SoapObject)mResponseVector.get(i)).getProperty("answerBy").toString())+" ");
                                ((TextView) parent.findViewById(R.id.ivAnswerTime)).setText(Html.fromHtml(((SoapObject)mResponseVector.get(i)).getProperty("cDate").toString()));

                                RelativeLayout mRelativeLayout = ((RelativeLayout) parent
                                        .findViewById(R.id.rlAnswerId));
                                mRelativeLayout.setId(i);
                                mRelativeLayout
                                        .setOnClickListener(new OnClickListener() {
                                            public void onClick(View v) {
                                                Intent intent = new Intent(QuestionDetailActivity.this,ShowAllAnswerActivity.class);
                                                intent.putExtra("listPosition",v.getId());
                                                startActivity(intent);

//                                              

    startActivity(new Intent(
    //                                                      QuestionDetailActivity.this,
    //                                                      ShowAllAnswerActivity.class));
                                                     Toast.makeText(QuestionDetailActivity.this,""+v.getId(),
                                                    Toast.LENGTH_LONG).show();
                                                }
                                            });
                                    layout.addView(parent);
                                }

I hope this code helpful to you.

DynamicMind
  • 4,240
  • 1
  • 26
  • 43