From 62247b867fbea144577ae49611822b85320ef979 Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Wed, 29 Mar 2017 15:09:59 +1100 Subject: [PATCH] Fix padding on 2.3 devices. The CardView extends FrameLayout. This layout has some problems with margins: http://stackoverflow.com/questions/5401952/framelayout-margin-not-working. These can be overcome in most situations by swithcing from a margin to some padding on the child view. The reason it is okay to do this in most cases is because the child view is usually a layout such as a ConstraintLayout anyway. For such cases, the difference between margin and padding is not much different, because there are usually not any background colours or borders applied (where padding vs margin would usually make a difference). --- app/src/main/res/layout/activity_app_list.xml | 8 ++++---- app/src/main/res/layout/app_card_featured.xml | 2 +- app/src/main/res/layout/app_card_horizontal.xml | 2 +- app/src/main/res/layout/app_card_large.xml | 2 +- app/src/main/res/layout/app_card_list_item.xml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/res/layout/activity_app_list.xml b/app/src/main/res/layout/activity_app_list.xml index 0e3f2969b..49c70c72f 100644 --- a/app/src/main/res/layout/activity_app_list.xml +++ b/app/src/main/res/layout/activity_app_list.xml @@ -14,10 +14,10 @@ + android:paddingStart="16dp" + android:paddingLeft="16dp" + android:paddingEnd="16dp" + android:paddingRight="16dp"> + android:padding="12dp"> diff --git a/app/src/main/res/layout/app_card_horizontal.xml b/app/src/main/res/layout/app_card_horizontal.xml index b3c3788ea..43f91c92f 100644 --- a/app/src/main/res/layout/app_card_horizontal.xml +++ b/app/src/main/res/layout/app_card_horizontal.xml @@ -10,7 +10,7 @@ + android:padding="8dp"> diff --git a/app/src/main/res/layout/app_card_large.xml b/app/src/main/res/layout/app_card_large.xml index 67aceef14..ded08f3b6 100644 --- a/app/src/main/res/layout/app_card_large.xml +++ b/app/src/main/res/layout/app_card_large.xml @@ -10,7 +10,7 @@ + android:padding="8dp"> diff --git a/app/src/main/res/layout/app_card_list_item.xml b/app/src/main/res/layout/app_card_list_item.xml index c35300a09..e88bdb814 100644 --- a/app/src/main/res/layout/app_card_list_item.xml +++ b/app/src/main/res/layout/app_card_list_item.xml @@ -10,7 +10,7 @@ + android:padding="8dp">