开发者

android editText is cursor visible?

Is there any way to know if on a edit text is visible or not the cursor? I need to 开发者_如何学Goknow so I can adapt a delete method. Thanks


public static final int getSelectionStart (CharSequence text) Since: API Level 1

Return the offset of the selection anchor or cursor, or -1 if there is no selection or cursor.

So if it returns -1 you know there is no cursor.

EDIT:

editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
    @Override
    public void onFocusChange(View v, boolean hasFocus) {
        if (hasFocus) {
            // cursor visible!!!
        }
    }
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜