Fix spacing between grid items

This commit is contained in:
Naveen 2023-04-11 14:33:59 +05:30
parent c3ad086806
commit 8506513871
3 changed files with 21 additions and 15 deletions

View File

@ -15,10 +15,9 @@ class SelectEventColorDialog(val activity: Activity, val colors: IntArray, var c
val view = activity.layoutInflater.inflate(R.layout.dialog_select_event_color, null) as ViewGroup
val colorAdapter = CheckableColorAdapter(activity, colors, currentColor)
view.color_grid.apply {
layoutManager = AutoGridLayoutManager(
context = activity,
itemWidth = activity.resources.getDimensionPixelSize(R.dimen.smaller_icon_size)
)
val width = activity.resources.getDimensionPixelSize(R.dimen.smaller_icon_size)
val spacing = activity.resources.getDimensionPixelSize(R.dimen.small_margin) * 2
layoutManager = AutoGridLayoutManager(context = activity, itemWidth = width + spacing)
adapter = colorAdapter
}

View File

@ -1,12 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.AppCompatImageView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/checkable_color_button"
android:layout_width="@dimen/smaller_icon_size"
android:layout_height="@dimen/smaller_icon_size"
android:layout_margin="@dimen/small_margin"
android:background="@drawable/button_background_rounded"
android:clickable="true"
android:focusable="true"
android:padding="@dimen/medium_margin"
tools:src="@drawable/ic_check_vector" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/small_margin">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/checkable_color_button"
android:layout_width="@dimen/smaller_icon_size"
android:layout_height="@dimen/smaller_icon_size"
android:background="@drawable/button_background_rounded"
android:clickable="true"
android:focusable="true"
android:padding="@dimen/medium_margin"
tools:src="@drawable/ic_check_vector" />
</FrameLayout>

View File

@ -5,7 +5,7 @@
android:id="@+id/color_grid_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/activity_margin"
android:paddingHorizontal="@dimen/normal_margin"
android:paddingTop="@dimen/big_margin"
android:paddingBottom="@dimen/medium_margin">