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

@@ -22,10 +22,11 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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.1.0'
compile 'com.android.support:gridlayout-v7:22.1.0'
compile 'com.android.support:cardview-v7:22.1.1'
compile 'com.android.support:recyclerview-v7:22.1.1'
compile 'com.android.support:support-annotations:22.2.0'
compile 'com.android.support:gridlayout-v7:22.2.0'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.0'
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'
}

View File

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

View File

@@ -14,12 +14,9 @@
limitations under the License.
-->
<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"
android:id="@+id/fragment_forecast"
android:name="com.example.android.sunshine.app.ForecastFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@android:layout/list_content"
app:sharedElementTransitions="true"
/>
android:layout_height="wrap_content"
app:sharedElementTransitions="true"/>

View File

@@ -13,35 +13,69 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/col"
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_width="match_parent"/>
<LinearLayout
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="?attr/colorPrimary"
android:orientation="vertical">
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeight"
android:layout_gravity="center"
android:scaleType="center"
android:src="@drawable/ic_logo"
android:contentDescription="@string/app_name"/>
</LinearLayout>
</RelativeLayout>
app:layout_scrollFlags="scroll|enterAlways"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<ImageView
android:layout_marginTop="?attr/actionBarSize"
android:layout_width="wrap_content"
android:layout_height="?attr/listPreferredItemHeight"
android:layout_gravity="center_horizontal"
android:contentDescription="@string/app_name"
android:scaleType="center"
android:src="@drawable/ic_logo"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.v7.widget.Toolbar>
</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>