Skip to content

做了一点修改 #3

Description

@ruodezizaiyi

1.针对标记了的EditText已获焦点,然后再点击另一个EditText,软键盘不应该先隐藏,然后在按正常流程获取焦点.应该保有焦点,故和filter划归到一类.
public boolean isTouchView(View[] views, MotionEvent ev) {
if (views == null || views.length == 0) return false;
int[] location = new int[2];
List allViews = new ArrayList<>();
for (int i = 0; i < hideSoftByEditViewIds().length; i++) {
View editview = findViewById(hideSoftByEditViewIds()[i]);
allViews.add(editview);
}
for (View view : views) {
allViews.add(view);
}

    for (View view : allViews) {
        view.getLocationOnScreen(location);
        int x = location[0];
        int y = location[1];
        if (ev.getX() > x && ev.getX() < (x + view.getWidth())
                && ev.getY() > y && ev.getY() < (y + view.getHeight())) {
            return true;
        }
    }
    return false;
}

2.个人觉得这种特定的Activity,用abstract标记方法更合适...可能继承都不太好.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions