2017-03-16 6 views
0

私は既存のプロジェクトを持っていますが、最近最近の更新で誤ってedittextを表示し始めました。下のスクリーンショットのアプリのこの特定の部分が変更されていないので、私はサポートライブラリのいくつかのバグを期待していますが、わかりません。EditTextユーザー入力がヒントテキストの上部に表示されています

基本的に問題は、ユーザーが編集テキストにテキストを入力すると、ヒントテキストが消えず、下のスクリーンショットに示すように表示されていることです。以下は

Screenshot showing problem

EditTextsは、次のコードにあなたが提供することができます任意の助け

Bundle bundle = getIntent().getExtras(); 
     indexAndFields = (HashMap<Integer, String>) bundle.getSerializable("indexAndFields"); 
     fieldAndValue = (HashMap<Integer, String>) bundle.getSerializable("fieldAndValue"); 
     currentTableName = bundle.getString("tableName"); 

     fieldDataList = rebuildFieldDataListFromJson(bundle.getString("tableAndDescription")); 
     Log.d("RowEditor", bundle.getString("tableAndDescription")); 
     lblNoPrimaryKeyInfo = (TextView)findViewById(R.id.noPrimaryKeyInfo); 

     for (Integer data : fieldAndValue.keySet()) 
     { 
      int index = data; 

      FieldData fieldData = getFieldDataFromFieldName(indexAndFields.get(index)); 

      TextInputLayout textInputLayout = new TextInputLayout(this); 

      EditText editText = new EditText(RowEditor.this); 
      editText.setHint(indexAndFields.get(index)); 
      editText.setText(fieldAndValue.get(data)); 
      if (!purchaseUpgraded) 
      { 
       editText.setEnabled(false); 
      } 
      fieldData.setEditText(editText); 
      fieldDataList.remove(index); 
      fieldDataList.add(index, fieldData); 

      textInputLayout.addView(editText); 

      if (fieldData.getIsPrimaryKey()) 
      { 
       isPrimaryKeyAvailable = true; 
       primaryKeyColumn = indexAndFields.get(index); 
       originalPrimaryKeyValue = fieldAndValue.get(data); 
       lblNoPrimaryKeyInfo.setVisibility(View.GONE); 
      } 
      controlContainer.addView(textInputLayout); 
     } 
     //Check if primary key is available, if not, disable all controls and display notification 
     disableControlIfNoPrimaryKey(); 
    } 

感謝を使用してプログラムで移入され、この特定のレイアウトのためのXMLコード

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <include layout="@layout/toolbar" /> 
    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 
     <LinearLayout android:id="@+id/controlContainer" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" /> 
    </ScrollView> 
    <TextView android:id="@+id/noPrimaryKeyInfo" 
     android:background="@color/api_error_background" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/no_primary_key_available_therefore_updates_and_deletes_cannot_be_done" 
     android:textStyle="bold" 
     android:layout_gravity="center_horizontal" 
     android:gravity="center_horizontal" 
     android:layout_alignParentBottom="true" 
     android:padding="5dp"/> 
    <TextView android:id="@+id/lblUpgradeStatus" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:visibility="gone"/> 
</LinearLayout> 

です。 @MikeMは、この問題の原因となったサポートライブラリのバージョン25.1.0のバグがある述べたように

+0

@SamusArinあなたは何と言っていますか?どうしたらいいですか? – Boardy

+0

サポートライブラリのどのバージョンを使用していますか? 'TextInputLayout'の原因となるバグが25.1.0にあります。 –

+1

それは私が使用しているバージョンですね。私は25.3.0にアップグレードしようとしています – Boardy

答えて

0

たぶんテキスト変更リスナーは、クイックフィックス

editText.addTextChangedListener(new TextWatcher() { 
    @Override 
    public void afterTextChanged(Editable s) { 
     if(editText.Text == "") 
     { 
      editText.setHint(hint); 
     } 
    } 

    @Override 
    public void beforeTextChanged(CharSequence s, int start, int count, int after) { 
     editText.setHint(""); 
    } 
}); 
+0

これは回避策です、実際の修正ではなく、EditTextのヒントが使用されていました – Boardy

+0

ええ、この問題から – samosaris

0

を提供することができます。サポートライブラリのバージョン25.3.0を使用するために私のgradle.buildファイルを更新しました。これで問題は修正されました。

関連する問題