TextView에 글자를 넣어주는 방법은 2가지가 있다. 많이 알려진 setText가 있고, append메서드 역시 사용될 수 있다. 두 메서드의 차이점은 다음과 같다. setText의 경우 메서드가 사용되면, 기존에 TextView에 있던 글자가 사라지고 새로운 텍스트로 대체된다. 반면, append메서드의 경우 기존에있던 text를 덮어쓰지 않고, 텍스트를 추가하게된다.
출처: Udacity drawable/magnitude_circle.xml (원모양 xml파일로 만들어주기) <!-- Background circle for the magnitude value --> <shape xmlns: android = "http://schemas.android.com/apk/res/android" android :shape= "oval" > <solid android :color= "@color/magnitude1" /> <size android :width= "36dp" android :height= "36dp" /> <corners android :radius= "18dp" /> </shape> colors.xml 사용하고자 하는 색상 정의하기 <!-- Color for an earthquake with magnitude 0 and 2 --> <color name= "magnitude1" > #4A7BA7 </color> <!-- Magnitude circle color for an earthquake with magnitude between 2 and 3 --> <color name= "magnitude2" > #04B4B3 </color> <!-- Magnitude circle color for an earthquake with magnitude between 3 and 4 --> <color name= "magnitude3" > #10CAC9 </color> <!-- Magnitude circle color for an...
댓글
댓글 쓰기