[안드로이드] study day4

승아·2020년 9월 27일
0

xml에 폰트 적용 방법

  1. res 하위에 font 디렉터리 생성

  2. tff파일(이름 소문자 변경)을 font 디렉터리에 넣어줌

  3. fontjalna.xml 파일 생성

<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
    <font
        android:fontStyle="normal"
        android:fontWeight="100"
        android:font="@font/jalnan"
        />
</font-family>
  1. TextView에 적용
<TextView
	android:fontFamily="@font/fontjalnan"/>

TextView 배경에 둥근 모서리 적용 방법

  1. drawable 디렉터리에 layout_background.xml 생성
<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#FFD966" />
    <stroke android:color="#FFD966" android:width="1dp" />
    <corners android:radius="10dp" />
</shape>
  1. TextView에 적용
<TextView
	android:background="@drawable/layout_background"/>

android resource linking failed 오류 해결

<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>

저 코드를 두번이나 써줘서 한참동안 삽질했다 .. 꼭 다시 한 번 확인하시길 !!

xml vs Programatically

https://blog.yena.io/studynote/2019/10/31/Android-View-Speed-Test.html
xml로 1000줄이 넘는 코드를 작성하다 생긴 궁금증.. 이 분이 기깔나게 실험해주셔서 궁금증을 해결할 수 있었다 ~

0개의 댓글