2014-04-11 53 views
0

SoftKeyBoard推動整個佈局向上包括標題欄。我在屏幕底部有EditText,ListView位於標題欄和EditText的RelativeLayout之間。我只需要ListView應該上去而不是標題欄。我用android:windowSoftInputMode="adjustPan"AndroidManifest.xml但沒有成功。 以下是我的屏幕。希望你有我的問題。SoftKeyBoard推動整體佈局向上

Screen 1

Screen 2

這是XML文件。

<RelativeLayout 
    android:id="@+id/topBarMusicDetailsEdit" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/top_bar" > 

    <TextView 
     style="@style/TopBarText" 
     android:text="@string/top_bar_text" /> 

    <ImageView 
     android:id="@+id/refreshButtonMusicDetails" 
     style="@style/left_button_style" 
     android:layout_alignParentRight="true" 
     android:layout_marginRight="10dp" 
     android:contentDescription="@string/app_name" 
     android:src="@drawable/refresh_icon" /> 

    <ImageView 
     android:id="@+id/backButtonMusicDetails" 
     style="@style/right_button_style" 
     android:src="@drawable/back_but" 
     android:contentDescription="@string/app_name" /> 
</RelativeLayout> 

<LinearLayout 
    android:id="@+id/detailToggleLayout" 
    android:layout_width="fill_parent" 
    android:layout_height="30.0dip" 
    android:layout_below="@+id/topBarMusicDetailsEdit" 
    android:layout_centerHorizontal="true" 
    android:background="@drawable/text_bar" > 

    <TextView 
     android:id="@+id/titleTxt" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_vertical" 
     android:layout_marginLeft="10.0dip" 
     android:text="Messaging" 
     android:textColor="#ffffff" 
     android:textStyle="bold" /> 
</LinearLayout> 

<View 
    android:id="@+id/grayline" 
    android:layout_width="fill_parent" 
    android:layout_height="10dp" 
    android:layout_below="@id/detailToggleLayout" 
    android:background="#808080" /> 

<ListView 
    android:id="@+id/chatList" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_above="@+id/enterMsgLayout" 
    android:layout_below="@+id/grayline" 
    android:cacheColorHint="@null" 
    android:divider="@null" 
    android:dividerHeight="0dp" 
    android:isScrollContainer="false" 
    android:stackFromBottom="false" 
    android:listSelector="@android:color/transparent" 
    > 
</ListView> 

<RelativeLayout 
    android:id="@+id/enterMsgLayout" 
    android:layout_width="fill_parent" 
    android:layout_height="44.0dip" 
    android:layout_alignParentBottom="true" > 

    <EditText 
     android:id="@+id/editChat" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_centerVertical="true" 
     android:layout_marginLeft="10.0dip" 
     android:layout_toLeftOf="@+id/sendChat_img" 
     android:background="@drawable/textfield_multiline_activated_holo_dark" 
     android:hint=" Enter Message" 
     android:paddingLeft="7.0dip" 
     android:textColor="#ffffff" 
     android:visibility="visible" > 
    </EditText> 
    <!-- "@drawable/blue_text_bar" --> 

    <ImageView 
     android:id="@+id/sendChat_img" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true" 
     android:layout_margin="5.0dip" 
     android:background="@drawable/icon_chat_msg" /> 
</RelativeLayout> 

+0

請發佈您的layout.xml文件 – laymelek

回答

1

設置windowSoftInputMode到你的活動adjustResizeManifest

<activity android:name="com.package.YourActivity" 
    android:windowSoftInputMode="adjustResize"/> 
0

添加下面一行在你的清單文件活動的聲明如下,希望將工作。

android:windowSoftInputMode="adjustPan|stateUnchanged|adjustResize"