3

キーボードが表示されているときに、ListViewの最初の数行の内容を表示できません。

私はこれを修正するためにさまざまなレイアウトコードと自分のコードを試して1日を過ごしましたが、問題をもう少し理解して、誰かが問題を解決するのを手伝ってくれるようになりました。

問題は、リストビュー(またはそのコンテナ)の高さをfill_parentに指定すると、リストビューの下部(画面の下部)がキーボードの上に表示される部分であるとAndroidに認識させることです。実際の内容はまだ表示されていません。なんらかの理由で、リストの内容の先頭までイベントスコールができません。コンテンツをラップするだけを指定すると、期待どおりにリストを表示する小さな領域が表示されます。

これが私の最新のレイアウトコードです(すべての試みで同じ問題が発生します)

 <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>

どんな助けでも本当にありがたいです。

4

1 に答える 1