반응형

res->drawable 폴더에 이미지 넣기

이미지 넣었으면 하단과 같이 android:background="@drawable/(넣은 이미지이름)"

넣어주면 이미지가 앱 전체에 배경화면으로 사용된다.

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

<layout xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/love"
        tools:context=".MainActivity">

        <Button
            android:id="@+id/showAllSentenceBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="전체말씀보기"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent" />


        <TextView
            android:id="@+id/good"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="명언이 들어갈 위치입니다"
            android:fontFamily="@font/bmjua_ttf"
            android:layout_margin="20dp"
            android:gravity="center"
            android:textColor="@color/white"
            android:textSize="30sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>

</layout>
반응형