투케이2K

366. (android/xml) [레이아웃] TextView 텍스트 뷰 기본 생성 본문

Android

366. (android/xml) [레이아웃] TextView 텍스트 뷰 기본 생성

투케이2K 2022. 11. 2. 10:56
반응형

[개발 환경 설정]

개발 툴 : AndroidStudio

 

[속성 설명]

1. android:id : 자바 코드에 매핑을 하기위한 컴포넌트 id 를 지정

2. android:layout_width : 가로 크기

3. android:layout_height : 세로 크기

4. android:layout_weight : 반응형 크기 비율

5. android:text : 텍스트 타이틀 명칭

6. android:textStyle : 텍스트 표시 스타일

7. android:textSize : 텍스트 사이즈

8. android:gravity : 컴포넌트 정렬 기준

9. android:textColor : 텍스트 색상

10. android:background : 컴포넌트 배경 지정 (색상 및 drawable 이미지 지정)

11. android:layout_marginTop : top 마진

12. android:layout_marginLeft : left 마진

13. android:layout_marginRight : right 마진

14. android:layout_marginBottom : bottom 마진

15. android:hint : EditText 값이 null 일 경우 표시되는 힌트 메시지
 

[소스 코드]

            <TextView
                android:id="@+id/title_text"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:text="[ 자바 임시 기능 테스트 ]"
                android:textColor="#ffffff"
                android:textSize="21dp"
                android:textStyle="bold"
                android:gravity="center"/>
 

[결과 출력]


 
반응형
Comments