在我的评估中,我有了一个编辑用户详情网页,我希望在相应的信使领域展示现名、电子邮件地址等,然后用户只要愿意,就能够抹掉这个名字,进入一个新的轨道。
是否有办法这样做? 感谢任何帮助
在我的评估中,我有了一个编辑用户详情网页,我希望在相应的信使领域展示现名、电子邮件地址等,然后用户只要愿意,就能够抹掉这个名字,进入一个新的轨道。
是否有办法这样做? 感谢任何帮助
有<代码>hint特征? 您可使用setHint(
>),将其编成XML(尽管您可能并不希望,因为XML不了解用户的名称/地址......)
×ml:
android:text="yourtext"
You can use text property in your xml file for particular Edittext fields. For example :
<EditText
android:id="@+id/ET_User"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="yourusername"/>
如同所有Edittext领域一样,如果用户想要改变Edittext特别领域,他就删除了旧案文并加入了新的案文。
http://www.ohchr.org。 仅请你获得具体<>。 在活动类别中编有dittext field id,并为之定案文。
Another way = programmatically
<>>Example:
EditText username=(EditText)findViewById(R.id.ET_User);
username.setText("jack");
你们能够这样做。
private EditText nameEdit;
private EditText emailEdit;
private String nameDefaultValue = "Your Name";
private String emailDefaultValue = "[email protected]";
A. 方法和内部方法
nameEdit = (EditText) findViewById(R.id.name);
nameEdit.setText(nameDefaultValue);
nameEdit.setOnTouchListener( new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (nameEdit.getText().toString().equals(nameDefaultValue)){
nameEdit.setText("");
}
return false;
}
});
nameEdit.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus && TextUtils.isEmpty(nameEdit.getText().toString())){
nameEdit.setText(nameDefaultValue);
} else if (hasFocus && nameEdit.getText().toString().equals(nameDefaultValue)){
nameEdit.setText("");
}
}
});
emailEdit = (EditText)findViewById(R.id.email);
emailEdit.setText(emailDefaultValue);
emailEdit.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(!hasFocus && TextUtils.isEmpty(emailEdit.getText().toString())){
emailEdit.setText(emailDefaultValue);
} else if (hasFocus && emailEdit.getText().toString().equals(emailDefaultValue)){
emailEdit.setText("");
}
}
});
首先,需要装上用户细节
然后,你需要找到你。 如果没有,EditText
<编码> EditText et = (EditText)findViewById(R.id.youredittext);
页: 1
et.setText(theUserName);
public class Main extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EditText et = (EditText) findViewById(R.id.et);
EditText et_city = (EditText) findViewById(R.id.et_city);
// Set the default text of second EditText widget
et_city.setText("USA");
}
}
1. 固定违约值或roid:
我们希望在今后版本的SDK中,每个观点和海底观点或群体观点都有一个缺省值。 但要克服这一点,仅仅在提交之前,检查是否真的空洞,然后分配违约值。
例如:
/* add 0 as default numeric value to a price field when skipped by a user,
in order to avoid parsing error of empty or improper format value. */
if (Objects.requireNonNull(edPrice.getText()).toString().trim().isEmpty())
edPrice.setText("0");
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...