전체 코드
<androidx.appcompat.widget.LinearLayoutCompat
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="80dp">
<TextView
android:id="@+id/textView1"
android:textStyle="bold"
android:textSize="25dp"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="TimeLine" />
<TextView
android:id="@+id/textView2"
android:textStyle="bold"
android:textSize="25dp"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="Untitle" />
</androidx.appcompat.widget.LinearLayoutCompat>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Scroll View는 한개의 자식만 가질 수 있음 하나로 묶기-->
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/post_item" />
<include layout="@layout/post_item2" />
</LinearLayout>
</ScrollView>
post_item 재사용
<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="480dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="409dp"
android:layout_height="387dp"
android:scaleType="centerCrop"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/cat2" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="0dp"
android:text="1,234"
android:textSize="18dp"
app:layout_constraintStart_toEndOf="@+id/imageView2"
app:layout_constraintTop_toTopOf="@+id/imageView2" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginBottom="12dp"
app:layout_constraintBottom_toTopOf="@+id/guideline3"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/ic_favorite" />
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@color/black"
app:layout_constraintTop_toTopOf="@+id/guideline3"
tools:layout_editor_absoluteX="0dp" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/imageView2"
app:srcCompat="@drawable/ic_more" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_begin="434dp" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="ssarmango"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline3" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="고양이가 너무 귀여워요!"
app:layout_constraintTop_toTopOf="@+id/textView"
tools:layout_editor_absoluteX="99dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
'Android > work' 카테고리의 다른 글
[UI구현 실습] 인스타그램 로그인 화면 (0) | 2021.08.02 |
---|---|
[실습02] 계산기 앱 만들기 (미완성) (0) | 2021.07.28 |
[실습01] 인스타그램 포스트 UI구현 (0) | 2021.07.28 |
리니어 레이아웃 예제 (0) | 2021.07.23 |