From 40cfddb348ca4b35f75af745d939fb92e419b702 Mon Sep 17 00:00:00 2001 From: seven332 Date: Sat, 21 Feb 2015 21:32:21 +0800 Subject: [PATCH] Fix SelectSearchImageLayout orientaion --- .../hippo/ehviewer/widget/SelectSearchImageLayout.java | 6 +++--- .../res/layout-land/widget_select_search_image_layout.xml | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/widget/SelectSearchImageLayout.java b/app/src/main/java/com/hippo/ehviewer/widget/SelectSearchImageLayout.java index ab35d98dc..a2fbeac71 100644 --- a/app/src/main/java/com/hippo/ehviewer/widget/SelectSearchImageLayout.java +++ b/app/src/main/java/com/hippo/ehviewer/widget/SelectSearchImageLayout.java @@ -77,10 +77,10 @@ public class SelectSearchImageLayout extends LinearLayout implements View.OnClic LayoutInflater.from(context).inflate(R.layout.widget_select_search_image_layout, this); // TODO It is a bad idea. - int childCount = getChildCount(); - if (childCount == 3) { + View firstChild = getChildAt(0); + if (firstChild instanceof TextView) { setOrientation(LinearLayout.VERTICAL); - } else if (childCount == 2) { + } else if (firstChild instanceof LinearLayout) { setOrientation(LinearLayout.HORIZONTAL); } else { throw new IllegalStateException("Can't guess orientation, did you changed the layout res ?"); diff --git a/app/src/main/res/layout-land/widget_select_search_image_layout.xml b/app/src/main/res/layout-land/widget_select_search_image_layout.xml index c8c9f7ef4..f8ed4562c 100644 --- a/app/src/main/res/layout-land/widget_select_search_image_layout.xml +++ b/app/src/main/res/layout-land/widget_select_search_image_layout.xml @@ -21,7 +21,6 @@ android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="center_vertical" - android:paddingRight="@dimen/search_item_interval_half" android:orientation="vertical"> + + + android:layout_weight="1">