开发者

Making not editable EditText component [duplicate]

This question already has answers here: 开发者_运维问答 Can we have uneditable text in edittext (2 answers) Closed 9 years ago.

I have an edit text. How can I make it non editable from the code. By giving the tag android:editable we can do in the layout.. But I need to do it in the code...Pls Help


I believe it is as simple as

editText.setEnabled(false);


Refer EDITTEXT

        edt.setClickable(false);
    edt.setFocusable(false);


      ***Layout***

<EditText android:id="@+id/edt"
        android:layout_width="200px" android:layout_height="wrap_content"
        android:text="" android:textSize="18sp"  android:maxLength="15">
    </EditText>


If you didnt find yet an answer, i have found this in the net:

http://code.google.com/p/android/issues/detail?id=2854


I am using for this problem, this solution:

valueText.setEnabled(false);
valueText.setClickable(false);
valueText.setFocusable(false);

//Just for better text vision
valueText.setTextColor(Color.WHITE);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜