Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用一个可绘制的edittext框,其中边框几乎没有图形,就像它有两条线边框。问题是如果我输入的文本与框的边缘重叠。我如何在开始时创建一个空格/间隙,这样我可以在距左端 1/2 个空格间隙后输入文本。
谢谢
EditText editText = (EditText) findViewById(R.id.textId); editText.setText("EditText component"); editText.setSelection(3);
尝试使用此代码将光标设置到位置 3。
如果您只想在字符串中添加空格,请尝试在代码中添加 paddingLeft 属性。
谢谢。