Im having a problem where the android scrollview starts hiding a pair of textviews I have at the top of my layout, I have found another person on this very site who had that
You can scroll programmatically.
Some code from my project:
protected void onResume() {
super.onResume();
final HorizontalScrollView svInMenu = (HorizontalScrollView) findViewById(R.id.svInMenu);
ViewTreeObserver vto = svInMenu.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
public void onGlobalLayout() {
svInMenu.scrollTo(svInMenu.getRight() / 4, 0);
}
});
}
Add android:layout_weight="1" to your scrollview. It will resolve the problem. Something like this
<ScrollView
android:id="@+id/scroll"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1" >
Found it !
It's the android:layout_gravity="center"
in the LinearLayout
that is the culprit. Just delete this and everything should be fine.
Your outer LinearLayout
has its height set to match_parent
. It should be wrap_content
instead. The inner LinearLayout
should also have height wrap_content
.
Have you tried setting
android:fillViewport="true"
in the ScrollView?
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:background="@color/title_color_dark_transparent" >