需要用的EditText只读缩进 [英] need EditText with readonly indent

查看:262
本文介绍了需要用的EditText只读缩进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人对如何实现在一个EditText的第一线,使得用户不能修改缩进空白缩进想法?

Does anyone have ideas on how to achieve a blank indent on the first line of an EditText such that the user cannot modify the indent?

我的目标是在凹痕面积叠加其他一些信息(可能是显卡),并仍然允许的EditText的其余部分回绕长行回到正常的左边缘。

My goal is to superimpose some other info (possibly graphics) in the indent area and still allow the rest of the EditText to wrap long lines back to the normal left margin.

回退是添加了其他信息单独的行或列,但也没有那么好一个用屏幕房地产。

Fallback would be to add a separate line or column for the "other info", but that isn't as good a use of the screen real estate.

也许有更好的方式来做到这一点。建议,欢迎!

Perhaps there is better way to do this. Suggestions are welcome!

推荐答案

我不知道什么是你想这样做,但你可以修改dinamically的文本,同时会出现。

I'm not sure on what are you trying to do but you can "modify" dinamically the text while is prompted.

使用一个 TextWatcher 你提供三种方法调用秩序。尝试在调试与一些断点,以更好地了解变量,并使用它们!

Use a TextWatcher that offers you three method called in order. Try in debug with some breakpoints to understand better the variables and use them!

((EditText) findViewById(R.id.myEditText)).addTextChangedListener(new TextWatcher() {
      @Override
      public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

      @Override
      public void onTextChanged(CharSequence s, int start, int before, int count) {}

      @Override
      public void afterTextChanged(Editable s) {}
});

这篇关于需要用的EditText只读缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆