我正在尝试创建一个EditText,它在只读和写入模式之间切换其状态.我的XML如下:
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textArea"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:lines="4"
android:inputType="textMultiLine">
</EditText>
Run Code Online (Sandbox Code Playgroud)
在我的代码中,我执行以下操作:
textArea = (EditText) convertView.findViewById(com.pravaa.mobile.R.id.textArea);
//isEditable decides if the EditText is editable or not
if(!isEditable){
textArea.setInputType(InputType.TYPE_NULL);
}
//the view is added to a linear layout.
addView(textArea);
Run Code Online (Sandbox Code Playgroud)
我的问题是文本没有被包装.我错过了什么吗?请帮助我.我还附上了我的输出图像.


视图中设置的文本是"12345678901234567 90123456789012345678901234567890 Nationwide Campaign New"
我能够通过删除来解决这个问题
android:inputType="textMultiLine"
Run Code Online (Sandbox Code Playgroud)
为了实现我使用的不可编辑功能
setFocusable(false);
Run Code Online (Sandbox Code Playgroud)
我想通过这称呼......
textArea.setInputType(InputType.TYPE_NULL);
Run Code Online (Sandbox Code Playgroud)
覆盖标志InputType.TYPE_TEXT_FLAG_MULTI_LINE.试着改为调用它......
textArea.setInputType(InputType.TYPE_NULL|InputType.TYPE_TEXT_FLAG_MULTI_LINE);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7595 次 |
| 最近记录: |