반응형

코드

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    android:orientation="vertical"
    >

    <TextView
        android:id="@+id/tv_count"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="1"
        android:textSize="100sp"
        android:gravity="center" />

    <Button
        android:id="@+id/btn_start"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Start"
        android:textSize="50sp" />

    <Button
        android:id="@+id/btn_stop"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="stop"
        android:textSize="50sp" />

    <Button
        android:id="@+id/btn_send"
        android:layout_width="match_parent"
        android:layout_height="86dp"
        android:text="Send service"
        android:textSize="50sp"/>

    <EditText
        android:id="@+id/editTextTextPersonName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="Name" />

</LinearLayout>

 

결과화면

 

이론적인 내용

    <TextView
        android:id="@+id/tv_count"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="1"
        android:textSize="100sp"
        android:gravity="center" />

 

android:id=

위의 내용에서

android:id="@+id/tv_count"

의 구문은, tv_count가 해당 id임을 나타낸다.

 

 

android:text=

기본적으로 어떤 값이 들어가는 설정함.

 

  • wrap_content는 콘텐츠에 필요한 치수대로 알아서 크기를 조절하라고 뷰에 지시합니다.
  • match_parent는 상위 뷰 그룹이 허용하는 한 최대한 커지도록 뷰에 지시합니다.

 

반응형