ListView isn't resizing when keyboard is shown
I have an Activity which shows a ListView. The items in the ListView have EditText fields in them, so when they tap a textfield the virtual keyboard slides into view. It is covering the ListView so you can't see the items behind the keyboard.
I've configured the Manifest for that Activity to adjustResize:
<activity android:name=".StatisticalActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
>
.. but it isn't resizing when t开发者_如何学Pythonhe keyboard is shown.
This the layout for my activity:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<RelativeLayout
android:id="@+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="40sp" android:paddingLeft="4dp" android:background="@drawable/toolbar_gradient" android:paddingRight="6dp">
...
</RelativeLayout>
<ListView
android:id="@+id/tableView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#333"
/>
</LinearLayout>
What am I doing wrong?
If you're setting the Activity to Full Screen using WindowManager.LayoutParams.FLAG_FULLSCREEN
, then the auto-resizing of the view doesn't work. So unfortunately, your best bet is to not use Full Screen (i.e. have the status bar at the top visible), at which point the resizing will work normally.
精彩评论