From b00d0c7f4762f5babb84da63afc4eaa0639c8370 Mon Sep 17 00:00:00 2001 From: Cassy Chun-Crogan Date: Thu, 20 Mar 2025 03:41:05 +0000 Subject: [DocsUI M3] Centre items in grid layout Previously items (columns) were not centred leading to any extra spacing going to the righthand side. Add an outer FrameLayout layer where width is match_parent which will evenly distribute the space between items. Within the FrameLayout centre the actual grid item with center_horizontal. See bug for demo. Bug: 404978773 Test: m DocumentsUIGoogle && manual inspection Flag: com.android.documentsui.flags.use_material3 Change-Id: I379a9a97c0e6c3b8656a9c730e862cdc903de370 --- .../layout/item_doc_grid.xml | 295 +++++++++++---------- 1 file changed, 151 insertions(+), 144 deletions(-) diff --git a/res/flag(com.android.documentsui.flags.use_material3)/layout/item_doc_grid.xml b/res/flag(com.android.documentsui.flags.use_material3)/layout/item_doc_grid.xml index 7d40f794b..a8e3148b4 100644 --- a/res/flag(com.android.documentsui.flags.use_material3)/layout/item_doc_grid.xml +++ b/res/flag(com.android.documentsui.flags.use_material3)/layout/item_doc_grid.xml @@ -13,163 +13,170 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - + app:cardBackgroundColor="?attr/colorSurfaceContainerLowest" + app:cardElevation="0dp" + app:strokeColor="?attr/colorSecondaryContainer" + app:strokeWidth="0dp"> + + + + + + + + + + - - + android:layout_width="@dimen/zoom_icon_size" + android:layout_height="@dimen/zoom_icon_size" + android:layout_gravity="center" + android:background="@drawable/circle_button_background" + android:padding="2dp" + android:scaleType="fitCenter" + android:src="@drawable/ic_zoom_out" /> - + + + - - - - - + + + - - + + + + + + + + + + android:gravity="center" + android:orientation="horizontal"> + + + + + + + + - + - \ No newline at end of file + \ No newline at end of file -- cgit v1.2.3-59-g8ed1b