NullPointerException
NullPointerException

Reputation: 37635

Problems with scrollview

I have a activity on my app, that shows a lot of options that can be configurated (textviews and textedits on a linearlayout)

But I have a problem, there are more items that my windows can show, and I can't go down doing down movement with my finger on the screen.

i am trying to do it with scrollview, but i can't my screens appears black and all mny items dissapear

here is my layout:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent">    
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:padding="10px">
<RelativeLayout
    android:gravity="center_vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <TextView
        android:id="@+id/MovileLabel" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="13px"
        android:text="@string/movilephonelabel"/>
    <EditText 
        android:id="@+id/Movile"
        android:layout_alignBaseline="@+id/MovileLabel"
        android:layout_alignParentRight="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:width="180px"/>
</RelativeLayout>
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="5pt"
    android:text="If you want to send SMS invitation" />

<View
    android:layout_gravity="center_horizontal"
    android:layout_width="fill_parent"
    android:layout_height="1dip"
    android:background="#808080"
    android:layout_marginTop="5px"
    android:layout_marginBottom="8px"/>

<RelativeLayout
    android:gravity="center_vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <TextView
        android:id="@+id/EmailLabel" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/emaillabel"
        android:layout_marginTop="13px"/>
    <EditText 
        android:id="@+id/Email"
        android:layout_alignBaseline="@+id/EmailLabel"
        android:layout_alignParentRight="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:width="180px"/>
</RelativeLayout>
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="5pt"
    android:text="If you want to send Email invitation" />

<View
    android:layout_gravity="center_horizontal"
    android:layout_width="fill_parent"
    android:layout_height="1dip"
    android:background="#808080"
    android:layout_marginTop="5px"
    android:layout_marginBottom="8px"/>

<RelativeLayout
    android:gravity="center_vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <TextView
        android:id="@+id/PermissionLabel" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/perlabel"
        android:layout_marginTop="13px"/>
    <Spinner 
      android:id="@+id/Permission"
      android:prompt="@string/perlabel"
      android:layout_alignBaseline="@+id/PermissionLabel"
      android:layout_alignParentRight="true"
      android:entries="@array/permissions_array"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />
</RelativeLayout>

<View
    android:layout_gravity="center_horizontal"
    android:layout_width="fill_parent"
    android:layout_height="1dip"
    android:background="#808080"
    android:layout_marginTop="5px"
    android:layout_marginBottom="8px"/>

<TextView
        android:id="@+id/HoursRangeLabel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hoursrangelabel"
        android:layout_marginRight="35dip"
        android:layout_marginTop="13px"/>
<RelativeLayout
    android:gravity="center_vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <TextView
        android:id="@+id/FromLabel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/fromlabel"
        android:layout_marginRight="35dip"
        android:layout_marginTop="13px"/>
    <DatePicker
        android:id="@+id/From"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@id/FromLabel"
        android:layout_toRightOf="@id/FromLabel"
        android:layout_marginRight="5dip"/>
    <TextView
        android:id="@+id/ToLabel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/tolabel"
        android:layout_alignBaseline="@id/From"
        android:layout_toRightOf="@id/From"/>
    <EditText
        android:id="@+id/To"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=""
        android:layout_alignBaseline="@id/From"
        android:width="70px"
        android:layout_alignParentRight="true"/>
</RelativeLayout>


<RelativeLayout
    android:gravity="center_vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/weekendlabel"
        android:id="@+id/weekendLabel"
        android:layout_marginTop="15px"/>
    <CheckBox
        android:id="@+id/settingsCheckBox"
        android:layout_alignBaseline="@+id/weekendLabel"
        android:layout_alignParentRight="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</RelativeLayout>
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="5pt"
    android:text="These fields are only necessary for Per Hours permission" />

<View
    android:layout_gravity="center_horizontal"
    android:layout_width="fill_parent"
    android:layout_height="1dip"
    android:background="#808080"
    android:layout_marginTop="5px"
    android:layout_marginBottom="8px"/>

<RelativeLayout
    android:gravity="center_vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <Button
        android:id="@+id/inviteButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/invite"
        android:width="100px"
        android:layout_marginLeft="40dip"/>
    <Button
        android:id="@+id/cancelbutton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/cancel"
        android:width="100px"
        android:layout_alignBaseline="@id/inviteButton"
        android:layout_alignParentRight="true"
        android:layout_marginRight="40dip"/>
</RelativeLayout>
</LinearLayout>
</ScrollView>

Upvotes: 0

Views: 894

Answers (2)

KDD
KDD

Reputation: 31

can only contains one child. You need to put everything on a common layout and then nested it in ScrollView. Hope it helps

Upvotes: 1

prolink007
prolink007

Reputation: 34554

Have you tried this:

scroll view

Take a look at that documentation and see if that will help you. There are examples in the link if you need to see some examples.

Upvotes: 1

Related Questions