How do I remove the extra pixels at the top of a ScrollView?

I have been working on an app that allows you to create a Truth Table and save it into HTML for use in word. I have the app working fine but I am trying to clean it up a bit. I have the following layout code to allow you to scroll the table while still keeping the name row at the top:

    <RelativeLayout
        android:id="@+id/RelLayout"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" >

        <TableLayout
            android:id="@+id/nameTable"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="1dp" >

            <TableRow
                android:id="@+id/nameRow"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        </TableLayout>

        <ScrollView
            android:id="@+id/scrollView1"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:scrollbarStyle="insideOverlay"
            android:scrollbars="vertical" >

            <TableLayout
                android:id="@+id/TruthTableLayout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="1dp"
                android:background="#000000" >
            </TableLayout>
        </ScrollView>
    </RelativeLayout>
</HorizontalScrollView>

This works fine for me overall, but when I scroll the table it doesn't fade immediately and instead shows a few pixels above the name row. So my question is how can I make those pixels go away?

Because I don't have the reputation to post images, here is a link to a screenshot of what I'm talking about. http://i.imgur.com/4KWc32O.png

Answers


For starters your margin here:

   <TableLayout
        android:id="@+id/nameTable"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="1dp" >

should be 0 on the top. SO if you need side margins it should be:

   <TableLayout
        android:id="@+id/nameTable"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="1dp"
        android:layout_marginLeft="1dp" >

Need Your Help

SOAP webservice: Multiple references to the same object in SOAP result

java soap jax-ws jax-rs jboss7.x

I'm building a SOAP service to be used in JBoss 7.1. Until now I'm only using annotations and no XML files of generated files. Both server and client work fine for POJO's.

Why is the first Link item being skipped?

d3.js

I've got a fairly simple visualization I'm trying to put together, but having a slight issue with the processing.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.