Skip to content

기능추가 : 커스텀 에디트뷰#23

Open
huhsay wants to merge 2 commits into
boostcampth:masterfrom
huhsay:master
Open

기능추가 : 커스텀 에디트뷰#23
huhsay wants to merge 2 commits into
boostcampth:masterfrom
huhsay:master

Conversation

@huhsay

@huhsay huhsay commented Jan 20, 2019

Copy link
Copy Markdown

커스텀 에디트뷰

  • 에드트뷰에 X 버튼을 추가하여, 검색어 작성후 에디트뷰의 text를 지우는 기능을 추가하였습니다.
  • http://gun0912.tistory.com/56 를 참고하였습니다.
    1

drawable 파일 호환성

  • drawable-v24 폴더에 있는 line_bottom.xml 파일 호환성 문제로 drawable 폴더에 복사하였습니다.

low version can't open 'line_bottom.xml' file
in 'drawable-v24' or 'drawable-v21' dir
so copy 'line_bottom.xml' to 'drawable' dir
}


@Override

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그룹화 시키고 싶은 함수들은 엔터 1번, 다른 그룹의 함수들을 엔터 2번으로 구분되어 있네요.
자체적인 코드 컨벤션을 지키는 것 같아 보기 좋네요 :)

android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

color 값을 color.xml 에서 관리해주는 것은 어떨까요?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안드로이드 자체 백터이미지를 가져온거라 생각하지 못했던 부분입니다. 감사합니다 😄

@Override
public boolean onTouch(View v, MotionEvent event) {
final int x = (int) event.getX();
if (clearDrawable.isVisible() && x > getWidth() - getPaddingRight() - clearDrawable.getIntrinsicWidth()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x의 위치값을 비교하는 조건절은 어떤 의미인가요??

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

에디트뷰 오른쪽에 x이미지를 붙여놓은 상태입니다.
때문에 터치된 x좌표가 전체 뷰의 크기에서 패딩과, x이미지의 가로크리를 뺀 좌표 이상이면 x 이미지가 클릭된 것으로 간주한 것입니다.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants