티스토리 뷰
안드로이드
[안드로이드] 텍스트에 그림자 넣기 + Error:(74, 31) Dimension types not allowed
Andrew Shin 2017. 1. 31. 15:01Error:(74, 31) Dimension types not allowed 오류에 대한 대처법
클라이언트로 부터 받은 요구사항은 "버튼에 올라가는 텍스트에 그림자 효과"를 넣어 달라 였다.
아래는 기존 코드와 버튼 이미지
1 2 3 4 5 6 7 8 9 | <Button android:id="@+id/ok_action" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#F44336" android:elevation="6dp" android:textColor="#ffffff" android:textSize="20dp" android:text="확인" /> | cs |
그림자 효과를 넣기위해 ShadowDx,Dy,Radius등을 추가하려고 한다.
아래는 수정된 코드 (굵은 글씨가 추가된 것)
1 2 3 4 5 6 7 8 9 10 11 12 | <Button android:id="@+id/ok_action" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#F44336" android:shadowDx="2dp" android:shadowDy="3dp" android:shadowColor="#000000" android:shadowRadius="1.5dp" android:textColor="#ffffff" android:textSize="20dp" android:text="확인" /> | cs |
이렇게 코드를 수정하고 빌드를 했는데 띠용
Error:(74, 31) Dimension types not allowed 라는 에러가 발생했다.
stack overflow에서 원인을 검색해보니, 그림자에는 단위를 입력하지 않는 다는 것이었다.
shadowDx="2dp" ▶ shadowDx="2" 이렇게 수정했다.
아래는 정상적으로 수정된 최종코드와 버튼 이미지
1 2 3 4 5 6 7 8 9 10 11 12 | <Button android:id="@+id/ok_action" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#F44336" android:shadowDx="2" android:shadowDy="3" android:shadowColor="#000000" android:shadowRadius="1.5" android:textColor="#ffffff" android:textSize="20dp" android:text="확인" /> | cs |
정상적으로 텍스트에 그림자가 적용되는 것을 확인할 수 있다.
'안드로이드' 카테고리의 다른 글
[안드로이드] 현재 디바이스의 IP 주소를 String 형태로 받아오기 (1) | 2018.06.17 |
---|---|
안드로이드 : 리스트 뷰(ListView)와 어댑터 패턴(Adapter)에 대한 기초 개념정리 2 (0) | 2016.09.16 |
안드로이드 : 리스트 뷰(ListView)와 어댑터 패턴(Adapter)에 대한 기초 개념정리 1 (1) | 2016.09.16 |
안드로이드 스마트폰 루팅 2 : 루팅하는법(Kingo root 사용법) (5) | 2016.03.04 |
안드로이드 스마트폰 루팅 1 : 루팅! 알고하자 (0) | 2016.03.01 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 안드로이드
- 터미널
- 파이썬예제
- 티라노 시그널
- socket
- 스레드
- 라즈베리파이
- 액터
- 파일
- 소켓
- Sort
- 디렉터리
- 정렬
- 자료구조
- UML
- 유즈케이스
- C
- 클라이언트
- 리눅스
- MFC
- 클래스
- 데이터베이스
- 악보
- C/C++
- 파이썬
- 소켓 프로그래밍
- C++
- 프로세스
- 티그널
- 쓰레드
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함