2016-10-14 6 views
0

Ich habe ein Problem mit der Größenanpassung meines Activity Layouts mit softInputMode="adjustResize". Es ändert sich nicht wirklich und ich sehe nicht, dass der Teil meines mehrzeiligen Textes unter der Tastatur ist. Wenn ich nur softInputMode="adjustPan" verwende, ohne adjustResize, Layout verschoben bis zur Eingabeposition, aber meine fab ist unter der Tastatur. Hier meine Layouthierarchie:Aktivität anpassenResize funktioniert nicht

<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: Wenn ich einklappbare Symbolleiste entfernen funktioniert Everinging gut. Aber ich brauche Kollabieren Symbolleiste (((

Antwort

1

auf diese Weise versuchen, die für mich funktioniert

Aktivität (nach setcontentView):...

this.getWindow() setSoftInputMode (WindowManager.LayoutParams. SOFT_INPUT_STATE_ALWAYS_HIDDEN);

AndroidMenifest.xml (Aktivität, die EditText enthält):

android: WindowsÒ ftInputMode = "adjustResize".

+1

Dies sollte weiche Tastatur verstecken. Wie hilft es? – Near1999

Verwandte Themen