3

このアイテムに関連するトピックをたくさん読みましたが、どれも私の問題を解決しませんでした。チャット画面のレイアウトは次のとおりです。

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/chatPage"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/speech_bg" >

<include
    android:id="@+id/chatHeader"
    layout="@layout/header_chat" />

<RelativeLayout
    android:id="@+id/chatView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@+id/chatHeader" >

    <RelativeLayout
        android:id="@+id/chatBottomView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@drawable/speech_text_bg"
        android:padding="5dp" >

        <RelativeLayout
            android:id="@+id/chatSendButton"
            android:layout_width="@dimen/chatSendButtonWidth"
            android:layout_height="@dimen/chatSendButtonHeight"
            android:layout_alignBottom="@+id/chatEditText"
            android:layout_alignParentRight="true"
            android:layout_marginLeft="5dp"
            android:background="@drawable/chat_send_btn_selector"
            android:onClick="ChatSendButtonClick" >

            <com.xxx.Utils.MyTextView
                xmlns:customtext="http://schemas.custom.com/android/customtext"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:text="@string/chatSendText"
                android:textColor="#ffffff"
                android:textSize="@dimen/chatSendTextSize" />
        </RelativeLayout>

        <EditText
            android:id="@+id/chatEditText"
            android:layout_width="match_parent"
            android:layout_height="@dimen/editTextHeight"
            android:layout_toLeftOf="@+id/chatSendButton"
            android:background="@drawable/edit_text"
            android:inputType="textMultiLine"
            android:maxLines="5" />
    </RelativeLayout>

    <com.handmark.pulltorefresh.library.PullToRefreshListView
        xmlns:pulltorefresh="http://schemas.custom.com/android/pulltorefresh"
        android:id="@+id/chatList"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/chatBottomView"
        android:cacheColorHint="#00000000"
        android:divider="#00000000"
        android:fadingEdge="none"
        android:fadingEdgeLength="0px"
        android:listSelector="#00000000"
        pulltorefresh:type="chat" />
</RelativeLayout>

AndroidManifest.xmlにAdjustPanオプションを追加しました。

<activity
    android:name=".ui.ChatActivity"
    android:screenOrientation="portrait"
    android:windowSoftInputMode="stateHidden|adjustPan" >
</activity>

スクロールビューがないため、AdjustResizeは私の実装では機能しません。

ソフトキーボードが開いたときにチャットページのサイズを変更/調整するための最良の方法は何ですか?私の知る限り、Androidでキーボードを聞くための実装もありません。キーボードの位置を理解するためにグローバルlayoutlistenerに関連するサンプルを見ただけですが、うまくいきませんでした。

Adjustpanオプションがチャット画面だけでなくアクションバーを非表示にするのはなぜですか?

4

1 に答える 1

2

chat.xml レイアウトの pulltorefreshlistview に追加:

android:transcriptMode="alwaysScroll"

それはすべてを解決しました。チャット リスト ビューがどのような条件でもスクロール可能な場合、リスト ビューを手動でスクロールするためにキーボード イベントをリッスンする必要はありません。

私以外の誰かにも役立つことを願っています..

于 2013-01-02T12:32:44.713 に答える