Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Friday, August 15, 2014

Android scrollview hiding top content in layout

Based on the screen layout in your Android application, some of the text in a TextView widget may not be visible i.e looks like its hidden/scrolled off at the top of the screen.

In the definition of the TextView in your layout xml, check to see if the below tag is present. This layout_gravity attribute is the problem why some of the text is not visible. Removing it from the TextView definition will display all data in the TextView widget.

android:layout_gravity="center_horizontal|center_vertical"

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="1.04"
        android:fillViewport="true"
        android:keepScreenOn="true"
        android:scrollbarStyle="insideInset"
        android:scrollbars="vertical"
        android:visibility="visible" >

        <TextView
            android:id="@+id/detailsText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            <!--android:layout_gravity="center_horizontal|center_vertical" -->      android:layout_marginTop="30dip" />
    </ScrollView>