androidtitlebaradjustpan

android: using adjustPan and without scrolling the title bar


I'm using android:windowSoftInputMode="adjustPan" in my manifest.xml. It's doing me the job just fine but there is something retarded about it. when i focus an EditText view that's, say in the bottom half of the screen, the title bar is also scrolled with the content of the activity.

image here

all i want is to freeze/float the title bar in place when scrolling the content. just like this:

image here

and no, I don't want to use adjustResize It overlaps views on top of each other

any help is greatly appreciated, been looking for the answer for a long time.


Solution

  • Found it!

    Simply changing the root view in the layout xml file to a ScrollView does the job.

    I don't even need to specify android:windowSoftInputMode

    Of course I have to have everything else in a single layout as the child of the ScrollView

    Edit

    your .xml file should look like this:

    <?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        ... >
        <LinearLayout>    // could be any other layout but linear works well here
            //insert all other views of the activity here
        </LinearLayout>
    </ScrollView>