El teclado oculta el contenido de ListView

I Cant See Contents of first few rows of my ListView when Keyboard is Visible.

I have spent the day trying various layout code out there as well as my own to fix this and I now understand the issue a little more to help somebody to help me solve it.

The issue is if i specify the height of the listview (or its container) to fill_parent then that is making android think that the bottom of the listview (bottom of the screen) is the part to show above the keyboard, even though there is no actual contents yet to show there. I cant event scoll up to the beginning of my list contents for some reason. Specifying just wrap content just shows a small area shwoing the list as expected.

Here's my latest layout code (all attempts produce the same issue)

 <RelativeLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:id="@+id/RelativeLayoutchat"
 >
<LinearLayout
android:orientation="horizontal"
android:gravity ="clip_horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true">
</LinearLayout>
<LinearLayout  android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ListView
    android:id="@+id/MessagesListView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:transcriptMode="alwaysScroll"
    android:divider="#000000"
    android:clickable="false"
    android:layout_weight="9"
    android:cacheColorHint="#00000000"/>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_weight="1"
    style="@android:style/ButtonBar"
    android:gravity="center"
    android:paddingLeft="3dip"
    android:paddingTop="3dip"
    android:paddingRight="3dip">
    <EditText
        android:id="@+id/msgBox"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:maxLines="5"
        android:enabled="true"
        android:textSize="17sp"
        android:maxLength="150"/>
    <Button
        android:id="@+id/sendbutton"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="send"
        android:layout_weight="4"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

Cualquier ayuda es muy apreciada.

preguntado el 30 de junio de 12 a las 22:06

I also have android:windowSoftInputMode="adjustPan" in the relevent activity tag. -

I have solved this issue but created another issue. The problem was having the activity as fullscreen. I removed the code and I can scroll to the very top of the list when keyboard is shown.. but I really want to have fullscreen throughout my app so anybody understand what the solution is please? -

1 Respuestas

I had the same issue and solved this with the below code.

en tu actividad:

mylistview.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
mylistview.setStackFromBottom(true);

or in xml file for

android:stackFromBottom="true"
    android:transcriptMode="normal"

y manteniendo el adjustResize for activity in manifest file.

<activity .... android:windowSoftInputMode="stateHidden|adjustResize" ..../>

Fuente: Presione Listview cuando aparezca el teclado sin ajuste Pan

contestado el 23 de mayo de 17 a las 11:05

This seems to only work at the activity layer, still leaves us fragment users in the dust - eliotm

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.