Skip to content

Commit

Permalink
Improve Header
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaMinZi committed Jun 8, 2021
1 parent f9fcf6c commit bee37f5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ class TextViewHolder(view: View): RecyclerView.ViewHolder(view) {
fun from(parent: ViewGroup): TextViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val view = layoutInflater.inflate(R.layout.header, parent, false)
view.setBackgroundColor(Color.LTGRAY)
return TextViewHolder(view)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ class SleepTrackerFragment : Fragment() {

// Add GridLayout
val manager = GridLayoutManager(activity, 3)
manager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int): Int = when (position) {
0 -> 3
else -> 1
}
}
binding.sleepList.layoutManager = manager

// recyclerView setting
Expand Down
5 changes: 5 additions & 0 deletions TrackmySleepQuality/app/src/main/res/layout/header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/header_text"
android:textColor="@color/white_text_color"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:background="@color/colorAccent"
android:padding="8dp" />

0 comments on commit bee37f5

Please sign in to comment.