2017-07-25 2 views
0

Bitte ich habe ein Problem mit meiner zweiten Symbolleiste.Toolbar TextInputLayout EditText - verloren TIPP

Ich möchte ein TextInputLayout in meiner Symbolleiste haben, aber ich möchte nicht, dass es FOCUSABLE ist. Es wird für Filter verwendet. So kann Benutzer nicht zu diesem editText eingeben.

Mein Code:

<android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar_2" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:background="@color/colorPrimary" 
       android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
       app:layout_collapseMode="none" 
       app:elevation="0dp" 
       app:layout_scrollFlags="scroll" 
       app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:orientation="vertical" 
        android:background="?attr/selectableItemBackground" 
        android:gravity="center_vertical" 
        android:minHeight="@dimen/spacing_xxlarge"> 

        <android.support.design.widget.TextInputLayout 
         android:id="@+id/lNameLayout2" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 

         android:paddingLeft="30dp" 
         android:paddingStart="30dp" 
         android:paddingEnd="30dp" 
         android:paddingRight="30dp"> 

         <EditText 
          android:id="@+id/ldesc" 
          android:fontFamily="sans-serif-thin" 

          android:clickable="false" 
          android:cursorVisible="false" 

          android:focusable="false" 
          android:focusableInTouchMode="false" 

          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:textSize="16sp" 
          android:text="another toolbar text" 
          android:textColor="@color/colorPrimaryBlack" 
          android:hint="@string/pref_title_filters"/> 
        </android.support.design.widget.TextInputLayout> 


       </LinearLayout> 
      </android.support.v7.widget.Toolbar> 

Wenn ich benutze: android: fokussierbarem = "false" android: focusableInTouchMode = "false", mein TIPP verschwinden.

Was soll ich tun? Vielen Dank !! :)

enter image description here

+0

warum Sie als EditText zweite Textbox möchten, können Sie es zu Textbox ändern. –

Antwort

0

Programmatically, können Sie folgendes tun:

yourEditText.setKeyListener(null); 
yourEditText.setText("Whatever you want"); 
Verwandte Themen