HTML input field hint

With a bit of JavaScript: <input value=”Enter username…” onfocus=”if (this.value === ‘Enter username…’) this.value=””” … /> HTML5 has a nice attribute for this, called placeholder: <input placeholder=”Enter username..” … /> but this attribute is not supported in old browsers.

how to make hint disappear when edittext is touched?

You can also custom your XML code by using Selector. Here is an example code. Create a selector. In file selector.xml <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:state_focused=”true” android:color=”@android:color/transparent” /> <item android:color=”@color/gray” /> </selector> In your view android:textColorHint=”@drawable/selector”

Java JTextField with input hint

You could create your own: import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import javax.swing.*; public class Main { public static void main(String[] args) { final JFrame frame = new JFrame(); frame.setLayout(new BorderLayout()); final JTextField textFieldA = new HintTextField(“A hint here”); final JTextField textFieldB = new HintTextField(“Another hint here”); frame.add(textFieldA, BorderLayout.NORTH); frame.add(textFieldB, BorderLayout.CENTER); … Read more

How to change the hint size of TextInputLayout

In your styles.xml <style name=”TextLabel” parent=”TextAppearance.Design.Hint”> <item name=”android:textSize”>16sp</item> </style> And then in your layout file: <android.support.design.widget.TextInputLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_marginLeft=”@dimen/activity_horizontal_margin” android:layout_marginRight=”@dimen/activity_horizontal_margin” android:layout_marginTop=”12dp” app:hintTextAppearance=”@style/TextLabel” android:minHeight=”30dp”>

Android EditText view Floating Hint in Material Design

Floating hint EditText: Add below dependency in gradle: compile ‘com.android.support:design:22.2.0’ In layout: <android.support.design.widget.TextInputLayout android:id=”@+id/text_input_layout” android:layout_width=”match_parent” android:layout_height=”wrap_content”> <EditText android:id=”@+id/editText” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:hint=”UserName”/> </android.support.design.widget.TextInputLayout>

How do I put hint in a asp:textbox

The placeholder attribute You’re looking for the placeholder attribute. Use it like any other attribute inside your ASP.net control: <asp:textbox id=”txtWithHint” placeholder=”hint” runat=”server”/> Don’t bother about your IDE (i.e. Visual Studio) maybe not knowing the attribute. Attributes which are not registered with ASP.net are passed through and rendered as is. So the above code (basically) … Read more