How do I make this scroll layout work?

Posted by JuiCe on Stack Overflow See other posts from Stack Overflow or by JuiCe
Published on 2012-06-25T14:48:42Z Indexed on 2012/06/25 15:16 UTC
Read the original article Hit count: 375

Filed under:
|

I am currently trying to get my UI to have a Title Bar, a bottom Button bar, with a ScrollView in between. I can get bits and pieces of it to work, but once I get a different piece working, the old part goes back to not showing up. Here is a picture of my UI on the left, with what I want it to look like on the right...(sorry for the sloppiness, I edited it in MS Paint :P )

To sum it up, I want the Version and Type fields to be moved with room for the other TextViews in the XML file, and I want both buttons to appear on the bottom bar.

enter image description here

EDIT :

The buttons on the bottom should be equal in size, I'm not too talented in making boxes in MS Paint

EDIT 2 : Sorry....here is my XML file

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1.0" >
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="SN : " />

            <TextView
                android:id="@+id/serialNumberView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="Ver : " />

            <TextView
                android:id="@+id/versionView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="Type : " />

            <TextView
                android:id="@+id/typeView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal" />

    </LinearLayout>

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1" >

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:orientation="vertical"
                android:layout_weight="1">


                    <CheckBox
                        android:id="@+id/floatCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Float" />

                    <CheckBox
                        android:id="@+id/tripCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Trip" />

                    <CheckBox
                        android:id="@+id/closeCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Close" />

                    <CheckBox
                        android:id="@+id/blockedCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Blocked" />

                    <CheckBox
                        android:id="@+id/hardTripCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Hard Trip" />

                    <CheckBox 
                        android:id="@+id/phaseAngleCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Phase angle wrong for closing" />

                    <CheckBox
                        android:id="@+id/diffVoltsCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Differential volts too low" />

                    <CheckBox
                        android:id="@+id/networkVoltsCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Network volts too low to close" />

                    <CheckBox
                        android:id="@+id/usingDefaultsCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Using Defaults( Reprogram )" />

                    <CheckBox
                        android:id="@+id/relaxedCloseActiveCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Relaxed Close Active" />

                    <CheckBox
                        android:id="@+id/commBoardDetectedCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Comm Board Detected" />

                    <CheckBox 
                        android:id="@+id/antiPumpBlock"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Anti-Pump Block" />

                    <CheckBox
                        android:id="@+id/motorCutoffCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Motor Cutoff Inhibit" />

                    <CheckBox
                        android:id="@+id/phaseRotationCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Phase Rotation Wrong" />

                    <CheckBox
                        android:id="@+id/usingDefaultDNPCheck"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text= "Using Default DNP Profile" />
            </LinearLayout>
    </ScrollView>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_weight="1" >

        <Button
            android:id="@+id/button3"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Back" />

        <Button
            android:id="@+id/button3"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Read" />
    </LinearLayout>
</LinearLayout>

© Stack Overflow or respective owner

Related posts about android

Related posts about user-interface