0

I've implemented a FragmentActivity using TabHost, ViewPager and Fragments following this short tutorial Tutorial to implement the use of TabHost in Android 2.2 + ViewPager and Fragments but Instead of a RelativeLayout in activity_main.xml I put a ScrollView but its not scrolling at all, how can I make it work?

Thanks

Community
  • 1
  • 1
Ramon Zuniga
  • 305
  • 2
  • 14

2 Answers2

0

Do you have enough content in the ScrollView for it to even need to scroll? As far as I know it doesn't scroll until you have enough content (e.g. views).

Furthermore, why not set up a RelativeLayout and then within it the ScrollView? You can then set the width and height of the ScrollView to fill the parent:

android: layout_height="fill_parent"

android: layout_width="fill_parent"

Hope this helps ;)

Community
  • 1
  • 1
REG1
  • 486
  • 4
  • 15
  • Thanks! I tried that but did not work. I solved my problem using a ScrollView as root on each fragment, every tab content has its own scroll and not the entire activity. – Ramon Zuniga Aug 08 '14 at 21:40
  • In the tutorial above, sample_fragment.xml uses a RelativeLayout, I changed it to ScrollView and set up a RelativeLayout within the ScrollView. – Ramon Zuniga Aug 08 '14 at 21:47
  • No problem, glad you found a solution :) – REG1 Aug 08 '14 at 23:46
0

TabHost is deprecated, switch to ViewPager, and you can put the scrollview inside the relativelayout as REG1 answer

Ringo
  • 850
  • 9
  • 24