Textview 提示文字

轉貼

Example source code for Android development. How set gray text to EditText when EditText is blank.
Hint text to display when the text is empty.
In layout/main.xml insert to EditText row Attribute Name android:hint=”Some text”
 
<EditText
        android:id="@+id/myEdit" 
 android:layout_height="wrap_content" android:layout_width="fill_parent"
        android:hint="Some text"
 android:singleLine="true"
</EditText>
Programatically you can use method setHint:
 
// setHint(CharSequence hint) example
(EditText)findViewById(R.id.myEdit).setHint("My text");
// or int resId as method setHint(int resId) 
EditText myEdit = findViewById(R.id.myEdit);
myEdit.setHint(R.string.app_name);

沒有留言:

張貼留言

非看不可

【超好用】貼圖快速裁切,極速上架。

輕鬆自製 LINE 貼圖!免安裝的超強網頁版「簡單的圖片工具」推薦 裁切、去背、標註一氣呵成,專為貼圖創作者打造的高效神器 很多創作者在製作 LINE 貼圖時,最常遇到的痛點就是: 尺...