Search code examples
androidxmlandroid-edittextscrollviewadjustpan

EditText on focus scroll up without resize other views


I'm trying to get an EditText field to scroll over my cameraPreview when selected. However it is now resizing the cameraPreview. I would be content with a adjustPan behaviour however I want the actionBar to stay on screen. I suspect it could be done with a scrollView however uptill no I can't prevent the cameraPreview from resizing.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity" >
    <FrameLayout
    android:id="@+id/cameraPreview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent" >

    </FrameLayout>

<!-- Fix for black overlay on menu -->
<FrameLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:background="@android:color/transparent" >
</FrameLayout>
<ScrollView 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:isScrollContainer="true"
        >
      <EditText
        android:id="@+id/inputCode"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="@color/White"
        android:ems="10"
        android:inputType="textNoSuggestions"
        android:maxLines="1"
        android:textColor="@color/Green"
        android:textSize="32sp"
        android:layout_alignParentBottom="true" >

    </EditText>
 </ScrollView>

deformed apple


Solution

  • Finally decided to scroll the whole view including the action bar