Android ScrollView Not Scrolling Correctly

Posted by user3133534 on Stack Overflow See other posts from Stack Overflow or by user3133534
Published on 2014-08-24T21:47:35Z Indexed on 2014/08/24 22:20 UTC
Read the original article Hit count: 727

I've been making my way through thenewboston's android tutorials and I'm stuck on number 35. There is supposed to be a scroll bar that takes up a weight of 30 at the top of the app. There are 6 textview/edittext field groups in the code, but I deleted 5 for simplicity. My problem is that all of the text and text boxes appear on the page and are not confined to the given weight (they all just show up on the page). Has anyone else had this problem or know how to fix it?

Please, I'm new to stackoverflow. If you think this is a stupid question, please explain to me why and how I can ask it better.

Here is what it looks like: http://imgur.com/gJmOgqk

<?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="wrap_content"
    android:orientation="vertical"
    android:weightSum="100" >

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="30" >

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

            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="TextView" />

            <EditText
                android:id="@+id/editText1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ems="10" >
            </EditText>

        </LinearLayout>
    </ScrollView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="40"
        android:orientation="vertical" >

        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="30"
        android:orientation="vertical" >


    <AnalogClock
        android:id="@+id/analogClock1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    </LinearLayout>
</LinearLayout>

© Stack Overflow or respective owner

Related posts about android

Related posts about android-layout