Updated the layout and dimensions to get us ready for lots of real estate.

This commit is contained in:
Dan Galpin
2015-05-25 02:16:17 -07:00
parent 45627b2047
commit 01cbc9f568
2 changed files with 83 additions and 40 deletions

View File

@@ -13,50 +13,88 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/ic_logo"
android:scaleType="center"/>
</android.support.v7.widget.Toolbar>
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="?attr/colorPrimary"
android:elevation="@dimen/appbar_elevation"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
<!-- These FrameLayouts are only there to line the image up with the keyline correctly, since
we cannot do addition of dimensions/attributes otherwise -->
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/abc_list_item_padding_horizontal_material"
android:layout_marginStart="@dimen/abc_list_item_padding_horizontal_material"
>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_icon"
android:layout_marginStart="@dimen/list_icon"
android:paddingLeft="@dimen/abc_list_item_padding_horizontal_material"
android:paddingStart="@dimen/abc_list_item_padding_horizontal_material">
<ImageView
android:layout_width="wrap_content"
android:layout_height="?attr/listPreferredItemHeight"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_logo"
android:contentDescription="@string/app_name"/>
</FrameLayout>
</FrameLayout>
</LinearLayout>
<!-- This is used as a strut to create two columns in our RelativeLayout -->
<android.support.v4.widget.Space
android:id="@+id/layout_center"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_centerInParent="true" />
<fragment
android:id="@+id/fragment_forecast"
android:name="com.example.android.sunshine.app.ForecastFragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignEnd="@id/layout_center"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@id/layout_center"
android:layout_below="@id/appbar"
tools:layout="@android:layout/list_content" />
<!-- We set elevation here only so the detail view doesn't get occluded
by the AppBar -->
<FrameLayout
android:id="@+id/weather_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:divider="?android:attr/dividerHorizontal"
android:orientation="horizontal"
tools:context="com.example.android.sunshine.app.MainActivity">
android:layout_alignLeft="@id/layout_center"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginTop="?attr/actionBarSize"
android:layout_alignStart="@id/layout_center"
android:elevation="@dimen/appbar_elevation"
android:paddingRight="@dimen/abc_list_item_padding_horizontal_material"
android:paddingEnd="@dimen/abc_list_item_padding_horizontal_material"
android:paddingBottom="@dimen/abc_list_item_padding_horizontal_material"
/>
<!--
This layout is a two-pane layout for the Items master/detail flow.
-->
<fragment
android:id="@+id/fragment_forecast"
android:name="com.example.android.sunshine.app.ForecastFragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
tools:layout="@android:layout/list_content" />
<FrameLayout
android:id="@+id/weather_detail_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@@ -38,4 +38,9 @@
<!-- Extra Padding -->
<dimen name="detail_view_extra_padding">@dimen/abc_list_item_padding_horizontal_material</dimen>
<!-- Needed if we aren't including the Material Design Library -->
<dimen name="appbar_elevation">4dp</dimen>
<!-- The amount we want the details view to overlap the app bar -->
<dimen name="details_app_bar_overlap">24dp</dimen>
</resources>