Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextView에 Drawable 붙일 때 이미지 크기가 정확하질 않아서요 #28

Closed
dio-brando opened this issue Oct 28, 2015 · 5 comments

Comments

@dio-brando
Copy link

뭐라고 해야 되나? 실제보다 크게 나와요. 그래서 텍스트뷰 크기를 이미지 픽셀 크기에 맞추면 이미지 가장자리가 잘립니다.
ImageButton에서도 마찬가진데, 그거는 scaletype을 아무거나 지정해 주면 해결되고
ImageView에서는 정상적으로 동작해서, 최소 크기에 맞춰서 이미지도 재조정됩니다.
옛날 버전은 안그랬지 싶은데 확인 좀 부탁드립니다.

screenshot_2015-10-29-10-05-40

맨 왼쪽이 ImageView, 가운데가 ImageButton, 맨 우측이 TextView에 Drawable 붙인 겁니다.
ImageView는 정상적이고, ImageButton은 크기값이 ImageView와 같은 상태입니다.

@ssomai
Copy link
Owner

ssomai commented Oct 28, 2015

안녕하세요~.

혹시 테스트 해볼만한 샘플소스 주실수 있을까요?

@dio-brando
Copy link
Author

메일로 보내드렸습니다. 지메일이 압축 첨부를 막아서 네이버로 보냈는데 잘 갔을지 모르겠네요.

심플하게 만든 테스트 프로젝트니까 바로 열어서 xml만 확인하시면 됩니다.

@ssomai
Copy link
Owner

ssomai commented Oct 29, 2015

메일이 안왔어요~ ㅎ

@dio-brando
Copy link
Author

죄송합니다. 왜 안 갔는지 이유를 모르겠는데 Gmail로 다시 보내드렸어요. 확장자만 바꿔서 앞축 푸시고 스튜디오로 오픈하시면 됩니다.

@ssomai
Copy link
Owner

ssomai commented Oct 29, 2015

확인해본 결과 말씀드릴게요~.

우선 ScalableLayout은 view 내부의 속성이나 기능들에 대해서는 관여하지 않고 layout만 조정합니다.
그래서 ImageView와 ImageButton의 차이가 나는 경우는 scaleType의 기본값이 달라서인것 같구요.

TextView의 drawableLeft의 경우는
ScalableLayout이 pixel이 아니라 비율로 배치되는 거라서 실제 배치된 pixel height가 TextView의 drawableLeft 이미지의 pixel height보다 작게되서 잘려버린것입니다.
그래서 이런 경우에는 drwableLeft를 쓰지 마시고 drawableLeft를 ImageView로 하고 TextView와 함께
하나의 ScalableLayout으로 만드는 것을 추천드립니다.

@ssomai ssomai closed this as completed Jun 5, 2016
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

No branches or pull requests

2 participants