2016-09-22 4 views
2

채팅 응용 프로그램을 만들었습니다. 스크린 샷을 첨부했습니다. 키보드가 활성화되어 있으면 도구 모음이 보이지 않습니다. 스택 오버플로 및 다른 웹 사이트에 대한 다양한 솔루션을 시도했지만 아무것도 나를 위해 작동하는 것. 코드를 첨부했습니다. 도와주세요. 1.layout 코드 :소프트 키보드가 나타나면 도구 모음을 맨 위에 고정하는 방법

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 
    android:id="@+id/main_content" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 
    <RelativeLayout 
     android:id="@+id/layout_chat_container" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     tools:ignore="RtlHardcoded" 
     android:layout_gravity="bottom" 
     android:isScrollContainer="false" 
     android:background="@color/newColor2"> 

     <include 
      android:id="@+id/app_bar" 
      layout="@layout/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="@dimen/toolbar_height" /> 
     <se.emilsjolander.stickylistheaders.StickyListHeadersListView 
      android:id="@+id/list_chat_messages" 
      style="@style/ListViewWithoutDividerStyle" 
      android:listSelector="@android:color/transparent" 
      android:fastScrollEnabled="true" /> 
     <ProgressBar 
      android:id="@+id/progress_chat" 
      style="@style/CenterProgressBarStyle" 
      android:visibility="gone" /> 

     <LinearLayout 
      android:id="@+id/layout_attachment_preview_container" 
      android:layout_height="match_parent" 
      android:layout_width="match_parent" 
      android:layout_alignParentEnd="true" 
      android:layout_alignParentRight="true" 
      android:layout_above="@+id/layout_chat_send_container" 
      android:background="@color/colorPrimary" 
      android:orientation="vertical" 
      android:visibility="gone"> 
      <View 
       android:id="@+id/divider_chat_attachments" 
       style="@style/HorizontalDividerStyle" /> 

      <com.flock.android.quickblox.chat.ui.widget.AttachmentPreviewAdapterView 
       android:id="@+id/adapter_view_attachment_preview" 
       style="@style/MatchWidth" /> 
     </LinearLayout> 
     <View 
      android:id="@+id/divider_chat" 
      style="@style/HorizontalDividerStyle" 
      android:layout_above="@+id/layout_chat_send_container" /> 
     <LinearLayout 
      android:id="@+id/layout_chat_send_container" 
      style="@style/MatchWidth" 
      android:layout_alignParentBottom="true" 
      android:background="@color/colorPrimary" 
      android:orientation="horizontal"> 
      <ImageButton 
       android:id="@+id/button_chat_attachment" 
       style="@style/BorderlessImageButtonStyle" 
       android:contentDescription="@null" 
       android:layout_gravity="center_vertical" 
       android:onClick="onAttachmentsClick" 
       android:src="@mipmap/ic_action_attachment" 
       android:visibility="gone" /> 
      <EditText 
       android:id="@+id/edit_chat_message" 
       style="@style/WeightWidth" 
       android:layout_height="wrap_content" 
       android:hint="@string/chat_edit_text_hint" 
       android:scrollHorizontally="false" 
       android:textColorHint="@color/colorActionMode" 
       android:inputType="textShortMessage|textMultiLine|textCapSentences" 
       android:maxLength="1024" 
       android:textColor="@color/white" 
       android:layout_marginLeft="@dimen/view_margin_small" 
       android:singleLine="false" /> 
      <ImageButton 
       android:id="@+id/button_chat_send" 
       style="@style/BorderlessImageButtonStyle" 
       android:contentDescription="@null" 
       android:layout_gravity="center_vertical" 
       android:onClick="onSendChatClick" 
       android:src="@mipmap/ic_sent" 
       android:text="@string/chat_send" /> 
     </LinearLayout> 
    </RelativeLayout> 
</android.support.design.widget.CoordinatorLayout> 

2.Screenshots :
Before After

+0

_i 스택 오버플로에서 다양한 솔루션을 사용해 보았습니다. 무엇을 시도 했습니까? 나는 코드에서 볼 수 없다. "android : windowSoftInputMode ="stateHidden | adjustPan "시도해 보셨습니까? – Piyush

+0

이 작업을 시도했지만 작동하지 않습니다 ... < android : name =". quickblox.chat.ui.activity.ChatActivity " android : screenOrientation =" 초상화 "" android : windowSoftInputMode = "stateAlwaysHidden | adjustPan"/> –

답변

2

코드 아래 시도하고 adjustResize 항상 확인하기 위해 활동의 메인 창 크기를 조정으로있는 ScrollView에 당신이 레이아웃인지 확인하기 화면에 소프트 키보드를위한 공간. 당신은 당신의 코드에있는 경우 전체 화면 활동에 대한

<activity 
     android:name=".YourActivity" 
     android:windowSoftInputMode="stateHidden|adjustResize"> 
+0

나는 이것도 시험해 봅니다.하지만 작동하지 않습니다. –

+0

그 큐에 대한 다른 대답을 찾을 수 있습니까? –

0

제거 플래그 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

는 매니페스트에서 활동 태그에 android:windowSoftInputMode="stateHidden|adjustResize"이 있어야합니다 확인하십시오.

이제 시도해보십시오 ... 도움이 되었습니까?

+0

고마워요. 내 문제를 해결할 수 없어요 .... –

+0

그 다른 질문에 대한 답을 찾을 수 있습니까? –

+0

나는 같은 문제를 가지고 주어진 해결책은 내 문제 만 해결했습니다 ... 문제를 해결하지 못하면 문제를 해결할 수 있습니다. ** setActionBar ** 도구 모음 및 xml 아래에 (@ + id/app_bar) StickyListHeadersListView 속성을 제공하려고 ... – Priya

관련 문제