2017-01-01 14 views
0

softKeyBoard私のレイアウトを押し上げます。私はキーボードのすべての提案を試みたが、それは助けにはならなかった、レイアウトはプッシュアップ、私はまた、この行にコードを追加しようとします:getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); しかし、これは動作しません。私は助けが必要です。ソフトキーボードが私のレイアウトを押し上げます

これはmy fragment xmlです。

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/chat_bg" 
android:isScrollContainer="false"> 


<LinearLayout 
    android:id="@+id/chatRetryArea" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="100dp" 
    android:gravity="center" 
    android:orientation="horizontal" 
    android:visibility="visible"> 

    <com.android.shanti.customViews.CustomTextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:text="@string/groupChatIsNotAvailable" 
     android:textColor="@color/gray_dark" /> 

    <com.android.shanti.customViews.CustomTextView 
     android:id="@+id/chatRetryLoad" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:paddingEnd="5dp" 
     android:paddingStart="10dp" 
     android:text="@string/groupChatIsNotAvailableRetry" 
     android:textColor="@color/purple_home" /> 

</LinearLayout> 


<RelativeLayout 
    android:id="@+id/chatLoadingPanel" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_centerInParent="true" 
    android:gravity="center"> 

    <ProgressBar 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:indeterminate="true" /> 

</RelativeLayout> 


<ListView 
    android:id="@+id/chatHistoryList" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/chatTools" 
    android:background="@color/green" 
    android:divider="@android:color/transparent" 
    android:dividerHeight="20dp" 
    android:padding="10dp" /> 

<RelativeLayout 
    android:id="@+id/chatTools" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:background="@color/white" 
    android:orientation="horizontal" 
    android:padding="20dp"> 

    <com.android.shanti.customViews.CustomEditText 
     android:id="@+id/chatMessageText" 
     android:layout_width="255dp" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:background="@color/transparent" 
     android:enabled="false" 
     android:maxLines="5" 
     android:paddingEnd="13dp" 
     android:paddingStart="13dp" /> 
</RelativeLayout> 

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="60dp" 
    android:layout_alignParentBottom="true" 
    android:orientation="horizontal" 
    android:padding="20dp"> 

    <ImageView 
     android:id="@+id/chatSendClick" 
     android:layout_width="30dp" 
     android:layout_height="30dp" 
     android:layout_alignParentEnd="true" 
     android:layout_centerVertical="true" 

     android:background="@drawable/send_right" /> 

    <ImageView 
     android:id="@+id/chatMessageBackground" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:layout_marginStart="90dp" 
     android:background="@drawable/chat_message_text" /> 

    <ImageView 
     android:id="@+id/chatAttachmentBtn" 
     android:layout_width="30dp" 
     android:layout_height="30dp" 
     android:layout_alignParentStart="true" 
     android:layout_centerVertical="true" 
     android:background="@drawable/chat_add_attachment" 
     android:clickable="true" 
     android:enabled="false" /> 

</RelativeLayout> 


</RelativeLayout> 

のAndroidManifest.xml:

<activity 
android:name=".main.MainActivity" 
android:configChanges="orientation|keyboardHidden|screenSize" 
android:label="@string/title_activity_main" 
android:launchMode="singleTop" 
android:windowSoftInputMode="adjustPan|adjustNothing" 
android:screenOrientation="portrait"/> 

<activity 
android:name=".login.signin.SignUpActivity" 
android:label="@string/title_activity_sign_up" 
android:windowSoftInputMode="adjustPan|adjustNothing" 
android:screenOrientation="portrait"/> 
+0

をあなたのビューを押し上げからソフトキーボードを防ぎたい場合にのみアンドロイド試してみてください。 windowSoftInputMode = "adjustNothing" –

+0

私は試しました。それでも動作しません –

+0

@ h.g。キーボードが現れたときにレイアウトをプッシュしたい、またはレイアウトをそのままにしたい、疑問が少し分かりませんか? –

答えて

1

あなたは あなたの関連するアクティビティタグで、次のように行います

<activity 
    ... 
    android:windowSoftInputMode="adjustPan"> 
</activity> 
+0

見る!それはalearyが存在する –

+0

adjustPanのみを使用しようとしましたが、adjustを使用していません。 –

+0

はい私はadjustPanも試しました –

関連する問題