diff --git a/res/layout/scene_mode_grid.xml b/res/layout/scene_mode_grid.xml
index 9984cf9..19555e6 100644
--- a/res/layout/scene_mode_grid.xml
+++ b/res/layout/scene_mode_grid.xml
@@ -38,5 +38,5 @@
         android:layout_height="wrap_content"
         android:columnWidth="@dimen/scene_mode_width"
         android:numColumns="auto_fit"
-        android:stretchMode="spacingWidthUniform"></GridView>
+        android:stretchMode="spacingWidthUniform" />
 </LinearLayout>
diff --git a/res/layout/scene_mode_grid_landscape.xml b/res/layout/scene_mode_grid_landscape.xml
new file mode 100644
index 0000000..3f75758
--- /dev/null
+++ b/res/layout/scene_mode_grid_landscape.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2016, The Linux Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+     * Redistributions of source code must retain the above copyright
+       notice, this list of conditions and the following disclaimer.
+     * Redistributions in binary form must reproduce the above
+       copyright notice, this list of conditions and the following
+       disclaimer in the documentation and/or other materials provided
+       with the distribution.
+     * Neither the name of The Linux Foundation nor the names of its
+       contributors may be used to endorse or promote products derived
+       from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:gravity="center"
+    android:orientation="horizontal">
+
+    <GridView
+        android:id="@+id/grid"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:columnWidth="@dimen/scene_mode_width"
+        android:numColumns="5"
+        android:stretchMode="spacingWidthUniform" />
+</LinearLayout>
diff --git a/res/layout/scene_mode_menu_view.xml b/res/layout/scene_mode_menu_view.xml
index bb2f38e..81ebfd8 100644
--- a/res/layout/scene_mode_menu_view.xml
+++ b/res/layout/scene_mode_menu_view.xml
@@ -27,6 +27,7 @@
      IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 -->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_gravity="center"
@@ -42,7 +43,8 @@
         android:layout_height="56dp"
         android:padding="10dp"
         android:background="@drawable/bg_custom_icon"
-        android:layout_gravity="center" />
+        android:layout_gravity="center"
+        tools:src="@drawable/ic_scene_mode_hdr" />
 
     <TextView
         android:id="@+id/label"
@@ -52,5 +54,6 @@
         android:gravity="center"
         android:layout_marginTop="8dp"
         android:textColor="@android:color/white"
-        android:textSize="16sp" />
+        android:textSize="16sp"
+        tools:text="@string/pref_camera_scenemode_entry_hdr" />
 </LinearLayout>
diff --git a/src/com/android/camera/SceneModeActivity.java b/src/com/android/camera/SceneModeActivity.java
index 280ff31..b37cce6 100644
--- a/src/com/android/camera/SceneModeActivity.java
+++ b/src/com/android/camera/SceneModeActivity.java
@@ -32,6 +32,7 @@
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
+import android.content.res.Configuration;
 import android.os.Bundle;
 import android.support.v4.view.PagerAdapter;
 import android.support.v4.view.ViewPager;
@@ -94,6 +95,16 @@
     }
 
     @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+        super.onConfigurationChanged(newConfig);
+
+        if (mPager != null) {
+            mAdapter = new MyPagerAdapter(this);
+            mPager.setAdapter(mAdapter);
+        }
+    }
+
+    @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         final boolean isSecureCamera = getIntent().getBooleanExtra(
@@ -104,7 +115,6 @@
         setContentView(R.layout.scene_mode_menu_layout);
         mSettingsManager = SettingsManager.getInstance();
 
-
         mCurrentScene = mSettingsManager.getValueIndex(SettingsManager.KEY_SCENE_MODE);
 
         mEntries = loadEntries();
@@ -226,7 +236,6 @@
 }
 
 class MyPagerAdapter extends PagerAdapter {
-
     private final SceneModeActivity mActivity;
 
     public MyPagerAdapter(SceneModeActivity activity) {
@@ -235,7 +244,10 @@
 
     @Override
     public Object instantiateItem(ViewGroup viewGroup, int position) {
-        final ViewGroup rootView = (ViewGroup) mActivity.getLayoutInflater().inflate(R.layout.scene_mode_grid, viewGroup, false);
+        final int orientation = mActivity.getResources().getConfiguration().orientation;
+        final int layoutResId = (orientation == Configuration.ORIENTATION_PORTRAIT) ? R.layout.scene_mode_grid : R.layout.scene_mode_grid_landscape;
+
+        final ViewGroup rootView = (ViewGroup) mActivity.getLayoutInflater().inflate(layoutResId, viewGroup, false);
         GridView mGridView = rootView.findViewById(R.id.grid);
         mGridView.setAdapter(new GridAdapter(mActivity, position));
         viewGroup.addView(rootView);
@@ -279,68 +291,68 @@
     public boolean isViewFromObject(View view, Object object) {
         return view == object;
     }
-}
 
-class GridAdapter extends BaseAdapter {
-    private final SceneModeActivity mActivity;
-    private final LayoutInflater mInflater;
-    private final int mPage;
+    private static class GridAdapter extends BaseAdapter {
+        private final SceneModeActivity mActivity;
+        private final LayoutInflater mInflater;
+        private final int mPage;
 
-    public GridAdapter(SceneModeActivity activity, int i) {
-        mActivity = activity;
-        mInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-        mPage = i;
-    }
-
-    @Override
-    public int getCount() {
-        int elem = mActivity.getElmentPerPage();
-        if (mPage == mActivity.getNumberOfPage() - 1) {
-            elem = mActivity.getNumberOfElement() - mPage * elem;
-        }
-        return elem;
-    }
-
-    @Override
-    public Object getItem(int position) {
-        return null;
-    }
-
-    @Override
-    public long getItemId(int position) {
-        return position;
-    }
-
-    @Override
-    public View getView(int position, View convertView, ViewGroup parent) {
-        View view = convertView;
-        ViewHolder viewHolder;
-
-        if (view == null) {
-            view = mInflater.inflate(R.layout.scene_mode_menu_view, parent, false);
-            viewHolder = new ViewHolder(view);
-            view.setTag(viewHolder);
-        } else {
-            viewHolder = (ViewHolder) convertView.getTag();
+        public GridAdapter(SceneModeActivity activity, int i) {
+            mActivity = activity;
+            mInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+            mPage = i;
         }
 
-        final List<CharSequence> entryList = mActivity.getEntries();
-        final List<Integer> thumbnailList = mActivity.getThumbnails();
+        @Override
+        public int getCount() {
+            int elem = mActivity.getElmentPerPage();
+            if (mPage == mActivity.getNumberOfPage() - 1) {
+                elem = mActivity.getNumberOfElement() - mPage * elem;
+            }
+            return elem;
+        }
 
-        final int idx = position + mPage * mActivity.getElmentPerPage();
-        viewHolder.imageView.setImageResource(thumbnailList.get(idx));
-        viewHolder.textTitle.setText(entryList.get(position + mPage * mActivity.getElmentPerPage()));
+        @Override
+        public Object getItem(int position) {
+            return null;
+        }
 
-        return view;
-    }
+        @Override
+        public long getItemId(int position) {
+            return position;
+        }
 
-    private static class ViewHolder {
-        public final ImageView imageView;
-        public final TextView textTitle;
+        @Override
+        public View getView(int position, View convertView, ViewGroup parent) {
+            View view = convertView;
+            ViewHolder viewHolder;
 
-        ViewHolder(final View rootView) {
-            imageView = rootView.findViewById(R.id.image);
-            textTitle = rootView.findViewById(R.id.label);
+            if (view == null) {
+                view = mInflater.inflate(R.layout.scene_mode_menu_view, parent, false);
+                viewHolder = new ViewHolder(view);
+                view.setTag(viewHolder);
+            } else {
+                viewHolder = (ViewHolder) convertView.getTag();
+            }
+
+            final List<CharSequence> entryList = mActivity.getEntries();
+            final List<Integer> thumbnailList = mActivity.getThumbnails();
+
+            final int idx = position + mPage * mActivity.getElmentPerPage();
+            viewHolder.imageView.setImageResource(thumbnailList.get(idx));
+            viewHolder.textTitle.setText(entryList.get(position + mPage * mActivity.getElmentPerPage()));
+
+            return view;
+        }
+
+        private static class ViewHolder {
+            public final ImageView imageView;
+            public final TextView textTitle;
+
+            ViewHolder(final View rootView) {
+                imageView = rootView.findViewById(R.id.image);
+                textTitle = rootView.findViewById(R.id.label);
+            }
         }
     }
 }
