0

I am using ListView inside ScrollView. But as we all know, It creates scrolling problems.

As per this link : Android list view inside a scroll view

I used that code. No doubt it is working fine. But now, problem occurs when any List Item has big content which will take 2-3 lines.

Check out image below for wide view : It has actually 4 options but because of scroll problem, it is showing 2 options.

enter image description here

I have also tried below extra code for height but It also dint work. What can be the solution for this ? I don't want to use header and footer as it is not suitable for our application. I want to prevent this Scroll problem and I want to display options perfectly.

listView.getPaddingTop() + listView.getPaddingBottom(); -> gives 0
Community
  • 1
  • 1
Jeeten Parmar
  • 5,568
  • 15
  • 62
  • 111
  • What is the question? – Mike M. Mar 11 '14 at 11:00
  • Then I have to ask, what is the point of having a ListView inside of a ScrollView for this app? Can you use a ViewPager instead? – Mike M. Mar 11 '14 at 11:20
  • It is going to contain many extra other files below the buttons. – Jeeten Parmar Mar 11 '14 at 11:34
  • I'm not sure what you mean by "files", but would those be something you could put in a Menu or a second Activity instead of having them listed directly on the main UI? – Mike M. Mar 11 '14 at 11:50
  • sorry, i mean was user controls. – Jeeten Parmar Mar 11 '14 at 11:51
  • Exactly. The screenshot you posted looks ideal (except for the missing answers, obviously) for a quiz-type application. "Next" and "End" would be all I would include as directly accessible controls. Anything additional seems like it would clutter the flow. Things like "Open New Test", "Check Scores", etc. (these are merely examples) would belong in either a Menu or secondary Activity. – Mike M. Mar 11 '14 at 11:56

1 Answers1

0

out this code for your child listview . It will solve the scrolling issue.

mListView.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                mScrollView.requestDisallowInterceptTouchEvent(true);
               int action = event.getActionMasked();
                switch (action) {
                    case MotionEvent.ACTION_UP:
                        mScrollView.requestDisallowInterceptTouchEvent(false);
                        break;
                }
                return false;
            }
        });
Sibin
  • 511
  • 6
  • 10