2017-12-18 91 views
2

嗨我有一個底部視圖的兩個recyclerView。當我點擊recyclerView中的一個項目時,應該出現一個帶有editText的彈出窗口。當我觸摸editText鍵盤被觸發時,線性佈局被推高。我不想推高鍵盤應該在屏幕上方可見的佈局。當鍵盤顯示時,帶有RecyclerView的LinearLayout會縮小嗎?

XML代碼

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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="match_parent" 
    android:isScrollContainer="false"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@+id/relative_layout" 
     android:orientation="vertical"> 

     <include layout="@layout/app_toolbar" /> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="@dimen/margin_1dp" 
      android:background="@color/black_color_10_percent" /> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@color/black_color_2_percent"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical"> 

       <RelativeLayout 
        android:id="@+id/tool_tip_layout" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center_vertical" 
        android:background="@color/color_white" 
        android:gravity="center_vertical" 
        android:padding="5dp"> 

        <TextView 
         android:id="@+id/text_view_user_tool_tip_label" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_centerVertical="true" 
         android:layout_marginLeft="@dimen/margin_10dp" 
         android:layout_toLeftOf="@+id/image_view_remove_tool_tip" 
         android:gravity="center|left" 
         android:singleLine="true" 
         android:textColor="@color/icon_un_selected_color" 
         android:textSize="@dimen/text_size_12dp" /> 

        <ImageView 
         android:id="@+id/image_view_remove_tool_tip" 
         android:layout_width="@dimen/margin_24dp" 
         android:layout_height="@dimen/margin_24dp" 
         android:layout_alignParentRight="true" 
         android:layout_gravity="right|center_vertical" 
         android:layout_marginRight="@dimen/margin_10dp" 
         android:background="@drawable/circle_grey_bg" 
         android:padding="@dimen/margin_6dp" 
         android:src="@drawable/ic_close_white_24dp" /> 

       </RelativeLayout> 

       <android.support.v7.widget.CardView 
        android:id="@+id/card_view_your_suggestions" 
        android:layout_width="match_parent" 
        android:layout_height="0dp" 
        android:layout_weight="2" 
        app:cardBackgroundColor="@color/light_grey_color" 
        app:cardCornerRadius="0dp" 
        app:cardElevation="0.5dp" 
        app:cardMaxElevation="1dp" 
        app:cardPreventCornerOverlap="true" 
        app:cardUseCompatPadding="true" 
        app:contentPaddingBottom="0dp"> 

        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:orientation="vertical"> 

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="@dimen/margin_40dp" 
          android:background="@color/color_grey" 
          android:gravity="center|left" 
          android:paddingLeft="@dimen/margin_12dp" 
          android:text="@string/text_your_selections" 
          android:textColor="@color/black_color_87_percent" 
          android:textSize="@dimen/text_size_14dp" /> 

         <android.support.v7.widget.RecyclerView 
          android:id="@+id/recycler_view_your_selection_list" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:scrollbars="none" /> 

        </LinearLayout> 

       </android.support.v7.widget.CardView> 

       <android.support.v7.widget.CardView 
        android:id="@+id/card_view_suggestions" 
        android:layout_width="match_parent" 
        android:layout_height="0dp" 
        android:layout_marginTop="@dimen/margin_6dp" 
        android:layout_weight="3" 
        android:background="@android:color/white" 
        app:cardCornerRadius="0dp" 
        app:cardElevation="0dp" 
        app:cardMaxElevation="1dp" 
        app:cardPreventCornerOverlap="true" 
        app:cardUseCompatPadding="true" 
        app:contentPaddingBottom="0dp"> 

        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:orientation="vertical"> 

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="@dimen/margin_40dp" 
          android:background="@color/color_grey" 
          android:gravity="center|left" 
          android:paddingLeft="@dimen/margin_12dp" 
          android:text="@string/text_your_suggestions" 
          android:textColor="@color/black_color_87_percent" 
          android:textSize="@dimen/text_size_14dp" /> 

         <android.support.v7.widget.RecyclerView 
          android:id="@+id/recycler_view_your_suggestion_list" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:background="@android:color/white" 
          android:fadeScrollbars="false" 
          android:scrollbarThumbVertical="@drawable/scrollbar_thumb" 
          android:scrollbarTrackVertical="@drawable/scrollbar_track" 
          android:scrollbars="vertical" /> 

        </LinearLayout> 

       </android.support.v7.widget.CardView> 

       <android.support.v7.widget.CardView 
        android:layout_width="match_parent" 
        android:layout_height="0dp" 
        android:layout_marginTop="@dimen/margin_8dp" 
        android:layout_weight="1.1" 
        android:visibility="gone" 
        app:cardBackgroundColor="@color/light_grey_color" 
        app:cardCornerRadius="0dp" 
        app:cardElevation="0dp" 
        app:cardMaxElevation="1dp" 
        app:cardPreventCornerOverlap="true" 
        app:cardUseCompatPadding="true" 
        app:contentPaddingBottom="0dp"> 

        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:orientation="vertical"> 

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="@dimen/margin_40dp" 
          android:background="@color/colorPrimaryDark" 
          android:gravity="center|left" 
          android:paddingLeft="@dimen/margin_12dp" 
          android:text="@string/text_add_new" 
          android:textColor="@color/black_color_87_percent" 
          android:textSize="@dimen/text_size_14dp" /> 

         <abihealth.emrappabi.widgets.MyCustomTextView 
          android:id="@+id/text_view_add_new_element" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_margin="@dimen/margin_8dp" 
          android:background="@drawable/edit_text_bg" 
          android:maxLines="1" 
          android:paddingLeft="@dimen/margin_8dp" /> 

        </LinearLayout> 
       </android.support.v7.widget.CardView> 
      </LinearLayout> 
     </RelativeLayout> 
    </LinearLayout> 

    <RelativeLayout 
     android:id="@+id/relative_layout" 
     android:layout_width="match_parent" 
     android:layout_height="@dimen/margin_40dp" 
     android:layout_alignParentBottom="true" 
     android:background="@color/color_grey"> 

     <LinearLayout 
      android:id="@+id/add_new_phrase_layout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_margin="@dimen/margin_6dp" 
      android:background="@android:color/white" 
      android:gravity="center_vertical" 
      android:orientation="horizontal"> 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:padding="@dimen/margin_6dp" 
       android:src="@drawable/icon_add_drawable" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:gravity="center|left" 
       android:paddingLeft="@dimen/margin_2dp" 
       android:text="@string/text_add_phrase" 
       android:textColor="@color/black_54_percent" 
       android:textSize="@dimen/text_size_14dp" /> 

     </LinearLayout> 
    </RelativeLayout> 
</RelativeLayout> 

Layout should not pushed up

回答

0

添加到清單中的活動,這對我的作品

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

我想這也沒有工作 –

+0

而你嘗試過把「 adjustPan「來代替? – Rainmaker

+0

是的,我也嘗試過......它仍在移動佈局 –