mardi 21 juin 2016

ScrollView causing resizing/repositioning of widgets

I have page viewer that is displaying a series of fragments which must be navigated by button presses. Everything is working fine, but I added a scrollview to allow the user to add a large amount of text. Now, whenever the user tries to write the buttons that are on the bottom of the screen are lifted with the keyboard.

enter image description here

If I cycle through all the fragments and return to that fragment, that issue corrects itself, that being the keyboard rises and those buttons are where they are supposed to be.

enter image description here

Any ideas why, or what I can do to correct?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".Kiosk.KioskTabPagerActivity">

<TextView
    android:id="@+id/textQuest7"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_marginTop="40dp"
    android:text="Prelim Quest"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="40dp"/>

<View
    android:id="@+id/prelim_line"
    android:layout_width="match_parent"
    android:layout_below="@id/textQuest7"
    android:layout_height="1dp"
    android:background="@android:color/darker_gray"/>

<TextView
    android:id="@+id/sample_question"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dp"
    android:text="Sample Question"
    android:layout_below="@id/prelim_line"
    android:textSize="24dp" />


<ScrollView
    android:id="@+id/welcome_scrollview"
    android:layout_width="800dp"
    android:layout_height="200dp"
    android:layout_weight="0.50"
    android:background="@drawable/scrollviewborder"
    android:layout_marginTop="10dp"
    android:layout_centerInParent="true"
    android:layout_below="@id/sample_question"
    android:fillViewport="false">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="5dp"/>

</ScrollView>

<!--  These are the bottons that control navigation -->
<RelativeLayout
    android:layout_alignParentBottom="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="40dp">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Previous"
            android:gravity="center"
            android:layout_marginEnd="150dp"/>

        <Button
            android:id="@+id/buttonBack8"
            android:onClick="jumpBack"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="150dp"
            android:padding="20dp"
            android:text="Back"
            android:textSize="24dp"
            android:drawableLeft="@drawable/ic_arrow_back"/>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Screen"
            android:gravity="center"
            android:layout_marginEnd="150dp" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_alignParentRight="true"
        android:layout_marginRight="40dp">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Next"
            android:gravity="center"
            android:layout_marginLeft="150dp"/>

        <Button
            android:id="@+id/buttonNext8"
            android:onClick="jumpForward"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="150dp"
            android:padding="20dp"
            android:text="Next"
            android:textSize="24dp"
            android:drawableRight="@drawable/ic_arrow_forward"/>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Screen"
            android:gravity="center"
            android:layout_marginLeft="150dp"/>

    </LinearLayout>
</RelativeLayout>
</RelativeLayout>

Aucun commentaire:

Enregistrer un commentaire