Android Studio获取到焦点的监听

uname.setOnFocusChangeListener(new View.OnFocusChangeListener() {
     
    @Override
    public void onFocusChange(View v, boolean hasFocus) {
     
        if (hasFocus) {
     
            Log.i(TAG, "获取到焦点了");
        } else {
     
            Log.i(TAG, "失去焦点了");
        }
    }
});

你可能感兴趣的:(Android,studio)