1

I have a tabhost in android studio that is inside a scroll view. The tabhost itself lies underneath some text. Here is an image of the xml file However, whenever i open the app on a device, the scroll view has the tabhost set at the top so i have to scroll up to see the text that is above it. Why is this and is there a fix?

Thanks in advance.

Alex Boullé
  • 431
  • 5
  • 17

1 Answers1

1

The TabHost is the first view that can request focus. So the work-around is to have another focusable view at the top of the LinearLayout within the ScrollView.

I used the following View for this purpose

    <View android:focusableInTouchMode="true" android:layout_width="0px" android:layout_height="0px"/>

Note: I was heavily inspired by TabHost inside a ScrollView forces it it to scroll to the bottom and Stop EditText from gaining focus at Activity startup.

Community
  • 1
  • 1
H. de Jonge
  • 878
  • 7
  • 25