Reputation: 431
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.
Upvotes: 1
Views: 425
Reputation: 890
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.
Upvotes: 1