Added Design Library AppBar Scrolling

This commit is contained in:
Dan Galpin
2015-05-25 03:37:38 -07:00
parent d9f57fbcfb
commit 77a0325f66
5 changed files with 69 additions and 34 deletions

View File

@@ -10,9 +10,13 @@ Build Tools version 21.1.2
Android Support AppCompat 22.2.0 Android Support AppCompat 22.2.0
Android Support Annotations 22.2.0 Android Support Annotations 22.2.0
Android Support GridLayout 22.2.0 Android Support GridLayout 22.2.0
Android Support CardView 22.2.0
Android Support Design 22.2.0
Android Support RecyclerView 22.2.0
Google Play Services GCM 7.0.0 Google Play Services GCM 7.0.0
BumpTech Glide 3.5.2 BumpTech Glide 3.5.2
Getting Started Getting Started
--------------- ---------------
This sample uses the Gradle build system. To build this project, use the This sample uses the Gradle build system. To build this project, use the

View File

@@ -22,10 +22,11 @@ android {
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar']) compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.github.bumptech.glide:glide:3.5.2' compile 'com.github.bumptech.glide:glide:3.5.2'
compile 'com.android.support:appcompat-v7:22.1.0' compile 'com.android.support:support-annotations:22.2.0'
compile 'com.android.support:support-annotations:22.1.0' compile 'com.android.support:gridlayout-v7:22.2.0'
compile 'com.android.support:gridlayout-v7:22.1.0' compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.android.support:cardview-v7:22.1.1' compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.1.1' compile 'com.android.support:design:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.google.android.gms:play-services-gcm:7.0.0' compile 'com.google.android.gms:play-services-gcm:7.0.0'
} }

View File

@@ -35,7 +35,6 @@
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
<!-- This Space is only there to line the image up with the <!-- This Space is only there to line the image up with the

View File

@@ -14,12 +14,9 @@
limitations under the License. limitations under the License.
--> -->
<fragment xmlns:android="http://schemas.android.com/apk/res/android" <fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fragment_forecast" android:id="@+id/fragment_forecast"
android:name="com.example.android.sunshine.app.ForecastFragment" android:name="com.example.android.sunshine.app.ForecastFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
tools:layout="@android:layout/list_content" app:sharedElementTransitions="true"/>
app:sharedElementTransitions="true"
/>

View File

@@ -13,35 +13,69 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<RelativeLayout <FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/fragment_main_base"
android:layout_below="@+id/appbar"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="match_parent"/> >
<LinearLayout
<android.support.design.widget.CoordinatorLayout
android:id="@+id/col"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:background="?attr/colorPrimary" app:elevation="0dp">
android:orientation="vertical">
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp" android:elevation="0dp"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<ImageView <ImageView
android:layout_width="match_parent" android:layout_marginTop="?attr/actionBarSize"
android:layout_width="wrap_content"
android:layout_height="?attr/listPreferredItemHeight" android:layout_height="?attr/listPreferredItemHeight"
android:layout_gravity="center" android:layout_gravity="center_horizontal"
android:contentDescription="@string/app_name"
android:scaleType="center" android:scaleType="center"
android:src="@drawable/ic_logo" android:src="@drawable/ic_logo"
android:contentDescription="@string/app_name"/> app:layout_scrollFlags="scroll|enterAlways" />
</LinearLayout> </android.support.v7.widget.Toolbar>
</RelativeLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview_forecast"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<!-- empty list -->
<TextView
android:id="@+id/recyclerview_forecast_empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_anchor="@+id/recyclerview_forecast"
app:layout_anchorGravity="fill"
android:gravity="center_horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:text="@string/empty_forecast_list" />
</android.support.design.widget.CoordinatorLayout>
</FrameLayout>