I do this, I get a field without a hint at all:

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dialog_add_category,container,false); TextInputLayout textInputLayout = (TextInputLayout)view.findViewById(R.id.ILetAddCategory); editText = (EditText)textInputLayout.findViewById(R.id.etAddCategory) ; textInputLayout.setHint("Floating Label"); return view; 

In xml

 <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/ILetAddCategory" android:hint="Floating Label" > <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/etAddCategory" android:inputType="text" /> </android.support.design.widget.TextInputLayout> 
  • Try hint for EditText and not for TextInputLayout - Yuriy SPb
  • Does not help. The same code works with EditText in activation, and we find TextInputLayout without view - xebeche
  • @xebeche in this case, try to apply through the activation in the fragment, getter hint programmatically. - Silento 4:05 pm
  • one
    C hint_om is all right, it can even not be dynamically messed because android: hint = "Floating Label" is what it is and it should work, since the TextInputLayout class itself does everything in the box. Therefore, I think a purely human error is to check the style, the background of the color is the same as the text, the DialogFragment is not from AppCompat, that is the type of that. - Shwarz Andrei pm
  • one
    @Shwarz Andrei Yes, thanks. there was confusion with inheritance! - xebeche

1 answer 1

C hint_om is all right, it can even not be dynamically messed because android:hint="Floating Label" is what it is and it should work, since the TextInputLayout class itself does everything in the box.

Therefore, you should check that the DialogFragment of android.support.v4.app.DialogFragment