[英]Getting the a text from EditText (but a Number)
I know that you can get a normal text like this: 我知道您可以得到像这样的普通文本:
EditText input = (EditText) findViewById(R.id.input);
String value = input.getText().toString();
but now I need a to an input like this: 0xFFFFFF (a Hex-Color), an Integer... But value is only a String and I don't know how to convert it... I'm using view.setBackgroundColor(color); 但是现在我需要这样的输入:0xFFFFFF(十六进制颜色),整数...但是值只是一个字符串,我不知道如何转换...我正在使用view.setBackgroundColor (颜色);
Thanks a lot! 非常感谢!
you can use the Color.parseColor(colorString);
您可以使用Color.parseColor(colorString);
function to convert your string to a color int 函数将您的字符串转换为color int
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.