Question

I know there are a thousand questions about this, but I've crawled through them and none of their solutions are working for me.

My activity has a tabbed interface with this kind of layout:

<RelativeLayout>
    <LinearLayout tabBar>
        <Button tab1 />
        <Button tab2 />
        <Button tab3 />
        <Button tab4 />
    </LinearLayout>
    <ViewFlipper>
        <fragment Tab1 />
        <fragment Tab2 />
        <fragment Tab3 />
        <fragment Tab4 />
    </ViewFlipper>
</RelativeLayout>

When the tab2 button is tapped in the LinearLayout then I change the ViewFlipper to display child 2 which is controlled by Tab2Fragment.

Tab2Fragment's layout looks like this:

<FrameLayout>
    <ListView/>
</FrameLayout>

When an item in the ListView is selected, I create a new fragment, let's call it Sub2Fragment and I add it as the child to the FrameLayout.

Sub2Fragment has a layout like this:

<LinearLayout android:layout_height="fill_parent" android:layout_width="fill_parent">
    <LinearLayout> <TextView /> <EditText /> </LinearLayout>
    <LinearLayout> <TextView /> <EditText /> </LinearLayout>
    <LinearLayout> <TextView /> <EditText /> </LinearLayout>
    <LinearLayout> <TextView /> <EditText /> </LinearLayout>
    <Button />
</LinearLayout>

When the soft keyboard is shown it's covering some of my EditTexts and my Button. I've tried wrapping that LinearLayout with a ScrollView as well:

<ScrollView android:layout_height="fill_parent" android:layout_width="fill_parent">
    <LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent">
        <LinearLayout> <TextView /> <EditText /> </LinearLayout>
        <LinearLayout> <TextView /> <EditText /> </LinearLayout>
        <LinearLayout> <TextView /> <EditText /> </LinearLayout>
        <LinearLayout> <TextView /> <EditText /> </LinearLayout>
        <Button />
    </LinearLayout>
</ScrollView>

I've also tried my manifest with and without android:windowSoftInputMode="adjustResize" on my Activity, but nothing I try gets the view to automatically resize so that the ScrollView will let me scroll through the entire content when the soft keyboard is visible.

I also tried wrapping the entire activity in a ScrollView, but that messed up my entire layout because it's based on filling the entire screen size and the ScrollView disconnects the child layout from what the actual size of the screen is...

Any help?

Was it helpful?

Solution

I found the problem... I wanted to get rid of the top status bar, so I added this to my Activity:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

That trampled the soft keyboard resizing of the view. Comment that out and it all works as expected.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top