326 일차 - IT 영단어 앱 : 홈 화면

2021. 11. 20. 22:58Diary/300~400

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.kwon.it_word.R


class HomeFragment : Fragment() {
    companion object {
        fun newInstance() {

        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        return inflater.inflate(R.layout.fragment_home, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
    }
}

 

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    android:paddingStart="20dp"
    android:paddingEnd="20dp"
    android:background="#ffffff"
    tools:context=".fragment.HomeFragment">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/home_user_info_layout"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:layout_marginTop="30dp"
        android:background="@drawable/default_border"
        android:paddingStart="35dp"
        android:paddingEnd="35dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ImageView
            android:id="@+id/imageView"
            android:layout_width="150dp"
            android:layout_height="100dp"
            android:scaleType="fitXY"
            android:src="@drawable/test_profile"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/textView6"
            style="@style/jua"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="암기한 단어"
            android:textColor="#333333"
            android:textSize="18sp"
            app:layout_constraintBottom_toBottomOf="@+id/imageView"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@+id/imageView"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/textView7"
            style="@style/jua"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp"
            android:text="1,052개"
            android:textColor="#333333"
            android:textSize="18sp"
            app:layout_constraintStart_toStartOf="@+id/textView6"
            app:layout_constraintTop_toBottomOf="@+id/textView6" />
    </androidx.constraintlayout.widget.ConstraintLayout>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/home_today_word_layout"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_marginTop="20dp"
        android:background="@drawable/default_border"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/home_user_info_layout">

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/imageView2"
            android:layout_width="25dp"
            android:layout_height="30dp"
            android:background="@drawable/book"
            android:backgroundTint="#666666"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/textView9"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/textView9"
            style="@style/jua"
            android:textAlignment="center"
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:text="오늘의 단어"
            android:textColor="#333333"
            android:textSize="18sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/home_book_mark_layout"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_marginTop="20dp"
        android:background="@drawable/default_border"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/home_today_word_layout">

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/imageView3"
            android:layout_width="25dp"
            android:layout_height="30dp"
            android:background="@drawable/bookmark"
            android:backgroundTint="#666666"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/textView10"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/textView10"
            style="@style/jua"
            android:textAlignment="center"
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:text="북마크"
            android:textColor="#333333"
            android:textSize="18sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    </androidx.constraintlayout.widget.ConstraintLayout>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/home_shop_layout"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_marginTop="20dp"
        android:background="@drawable/default_border"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/home_book_mark_layout">

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/imageView4"
            android:layout_width="35dp"
            android:layout_height="30dp"
            android:background="@drawable/shop"
            android:backgroundTint="#666666"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/textView11"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/textView11"
            style="@style/jua"
            android:textAlignment="center"
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:text="상점"
            android:textColor="#333333"
            android:textSize="18sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    </androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>