2016-10-14 19 views
0

Activityレイアウトのサイズ変更に問題があります。実際にはサイズ変更されていないので、キーボードの下にある複数行のテキストの一部が表示されません。 softInputMode="adjustPan"のみを使用してadjustResizeを使用しないと、レイアウトは入力位置まで移動しましたが、fabはキーボードの下にあります。ここで私のレイアウトの階層:アクティビティadjustResizeが動作しない

<android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="300dp" 
     android:fitsSystemWindows="true"> 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fitsSystemWindows="true" 
     app:contentScrim="?attr/colorPrimary" 
     app:layout_scrollFlags="scroll|snap"> 

    <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      app:layout_collapseMode="pin" 
      app:layout_scrollFlags="scroll"/> 
    </android.support.design.widget.CollapsingToolbarLayout> 
    </android.support.design.widget.AppBarLayout> 

    <android.support.v4.widget.NestedScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:descendantFocusability="beforeDescendants" 
     android:focusableInTouchMode="true" 
     android:scrollbars="vertical" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

    <requestFocus/> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:paddingBottom="@dimen/activity_vertical_margin" 
     android:paddingLeft="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     android:paddingTop="@dimen/activity_vertical_margin"> 

     <!-- Some another content --> 

     <android.support.design.widget.TextInputLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

     <EditText 
      android:id="@+id/field" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="@string/feedback" 
      android:inputType="textCapSentences|textMultiLine|textNoSuggestions" 
      android:maxLines="20" 
      android:minLines="10"/> 
     </android.support.design.widget.TextInputLayout> 
    </LinearLayout> 
    </android.support.v4.widget.NestedScrollView> 

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|end" 
     android:layout_margin="@dimen/support_fab_margin" 
     android:src="@drawable/ic_send"/> 
</android.support.design.widget.CoordinatorLayout> 

PS:もし私が崩壊ツールバーを削除すると、うまく動作します。 。。。

this.getWindow()setSoftInputMode(WindowManager.LayoutParams:しかし、私は崩壊し、ツールバーの(((

答えて

1

は、この方法を試してみてくださいそれは私のために働いて

活動(setcontentView後)が必要です。 SOFT_INPUT_STATE_ALWAYS_HIDDEN);

のEditTextが含まAndroidMenifest.xml(活性):

アンドロイド:windowSo ftInputMode = "adjustResize"

+1

これはソフトキーボードを隠すはずです。どのように役立ちますか? – Near1999

関連する問題