Android scrollview not working

I created some XML activity file. I wrote some code. I am using scrollview and this scrollview is not working.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:fillViewport="true"
android:background="#171717" >

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/relativeLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="22dp"
        android:background="#171717" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginBottom="15dp"
            android:layout_marginRight="15dp"
            android:background="@drawable/ic_launcher" />

        <EditText
            android:id="@+id/editText1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/imageView1"
            android:layout_alignParentLeft="true"
            android:layout_alignTop="@+id/imageView1"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="5dp"
            android:layout_toLeftOf="@+id/imageView1"
            android:background="#363636"
            android:paddingLeft="10dp"
            android:textColor="#ffffff" >
        </EditText>
    </RelativeLayout>

    <TextView
        android:id="@+id/latteryresult"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/circlelayout2"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="28dp"
        android:gravity="center"
        android:text="click the button"
        android:textColor="#ffffff"
        android:textSize="17dp" />

    <RelativeLayout
        android:id="@+id/circlelayout2"
        android:layout_width="250dp"
        android:layout_height="250dp"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="14dp"
        android:layout_marginTop="15dp" >


    </RelativeLayout>
  </RelativeLayout>

</ScrollView>

      

When I click on edit text and the keyboard shows - then I cannot scroll. scrollview doesn't work. What am I doing wrong? If anyone knows a solution please help me.

+3


source to share


1 answer


Your first one RelativeLayout

should be set android:layout_height

to wrap_content

.



Because it match_parent

does not allow the species to expand beyond the height (visible) ScrollView

.

0


source







All Articles