2013-04-28 123 views
3

我有一個佈局,其中包含屏幕底部的EditText和Button。在這上面是一個ListView。當彈出keyBoard時,我想讓EditText和按鈕可見。但是,這並不hapening給予windowSoftInputMode = 「adjustResize」使包含editText和按鈕的佈局位於鍵盤上方

下面inspite是我的佈局:

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/recents_header_bg" 
    android:padding="2dp" > 

    <TextView 
     android:id="@+id/tv_msg_header" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:text="Name" 
     android:textColor="@color/white1" 
     android:textSize="15sp" /> 

    <Button 
     android:id="@+id/bt_msg_cancel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:background="@drawable/bt_call_log" 
     android:text="Cancel" 
     android:textColor="@color/white1" /> 
</RelativeLayout> 

<FrameLayout 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_gravity="center" 
    android:layout_weight="1" > 

    <ListView 
     android:id="@+id/lv_msg_thread_list" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:cacheColorHint="#00000000" 
     android:divider="@color/recents_list_seperator" 
     android:dividerHeight="1dp" 
     android:duplicateParentState="true" 
     android:fadingEdge="none" 
     android:fastScrollEnabled="true" > 
    </ListView> 

    <TextView 
     android:id="@+id/tv_msg_error" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="center" 
     android:visibility="gone" /> 
</FrameLayout> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/grey05" 
    android:orientation="vertical" 
    android:padding="1dp" > 

    <EditText 
     android:id="@+id/et_msg_entry" 
     android:layout_width="match_parent" 
     android:layout_height="100dp" 
     android:gravity="top" 
     android:hint="Type your message here" /> 

    <Button 
     android:id="@+id/bt_msg_send" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="right" 
     android:background="@drawable/bt_call_log" 
     android:text="Send" 
     android:textColor="@color/white1" /> 
</LinearLayout> 

此外,在該活動給我的mainfest選項是:

<activity 
     android:name=".ui.MessageActivity" 
     android:screenOrientation="portrait" 
     android:windowSoftInputMode="stateHidden|adjustResize" 
     android:exported="false"/> 

有什麼辦法可以完成這項工作嗎?像在默認消息應用程序

回答

1

您的LinearLayout方向應該是horizontal,而不是vertical