diff --git a/app/src/main/java/com/lukas/music/ui/fragments/SongFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/SongFragment.kt
index 395fba0..859012b 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/SongFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/SongFragment.kt
@@ -6,10 +6,13 @@
import android.view.ViewGroup
import android.widget.TableRow
import android.widget.TextView
+import androidx.cardview.widget.CardView
+import androidx.core.view.setMargins
import androidx.fragment.app.Fragment
import com.lukas.music.databinding.FragmentSongBinding
import com.lukas.music.song.Song
+
class SongFragment : Fragment() {
private lateinit var binding: FragmentSongBinding
@@ -19,12 +22,22 @@
): View? {
binding = FragmentSongBinding.inflate(inflater)
binding.chords.isStretchAllColumns = true
+ val layout = TableRow.LayoutParams(
+ TableRow.LayoutParams.MATCH_PARENT,
+ TableRow.LayoutParams.MATCH_PARENT
+ )
+ layout.setMargins(10)
for (phrase in Song.currentSong.chordProgression.phrases) {
val row = TableRow(binding.root.context)
for (chord in phrase.chords) {
+ val card = CardView(binding.root.context)
+ card.radius = 10f
+ card.layoutParams = layout
val text = TextView(binding.root.context)
text.text = chord.toString()
- row.addView(text)
+ text.layoutParams = layout
+ card.addView(text)
+ row.addView(card)
}
binding.chords.addView(row)
}
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/SongFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/SongFragment.kt
index 395fba0..859012b 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/SongFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/SongFragment.kt
@@ -6,10 +6,13 @@
import android.view.ViewGroup
import android.widget.TableRow
import android.widget.TextView
+import androidx.cardview.widget.CardView
+import androidx.core.view.setMargins
import androidx.fragment.app.Fragment
import com.lukas.music.databinding.FragmentSongBinding
import com.lukas.music.song.Song
+
class SongFragment : Fragment() {
private lateinit var binding: FragmentSongBinding
@@ -19,12 +22,22 @@
): View? {
binding = FragmentSongBinding.inflate(inflater)
binding.chords.isStretchAllColumns = true
+ val layout = TableRow.LayoutParams(
+ TableRow.LayoutParams.MATCH_PARENT,
+ TableRow.LayoutParams.MATCH_PARENT
+ )
+ layout.setMargins(10)
for (phrase in Song.currentSong.chordProgression.phrases) {
val row = TableRow(binding.root.context)
for (chord in phrase.chords) {
+ val card = CardView(binding.root.context)
+ card.radius = 10f
+ card.layoutParams = layout
val text = TextView(binding.root.context)
text.text = chord.toString()
- row.addView(text)
+ text.layoutParams = layout
+ card.addView(text)
+ row.addView(card)
}
binding.chords.addView(row)
}
diff --git a/app/src/main/res/layout/fragment_song.xml b/app/src/main/res/layout/fragment_song.xml
index 20678ca..864e035 100644
--- a/app/src/main/res/layout/fragment_song.xml
+++ b/app/src/main/res/layout/fragment_song.xml
@@ -1,5 +1,6 @@
-
-
\ No newline at end of file
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:clipChildren="true"
+ android:dividerPadding="5dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+
+
+
\ No newline at end of file