Created
April 24, 2018 14:14
-
-
Save vorobeij/afa23f5131b18564e224750c4b9e7f39 to your computer and use it in GitHub Desktop.
collapsing toolbar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import kotlinx.android.synthetic.main.activity_details.toolbar | |
| .... | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_details) | |
| setSupportActionBar(toolbar) // at xml | |
| supportActionBar?.setDisplayHomeAsUpEnabled(true) | |
| .... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <android.support.design.widget.CoordinatorLayout 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:id="@+id/main_content" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:fitsSystemWindows="true"> | |
| <android.support.design.widget.AppBarLayout | |
| android:id="@+id/htab_appbar" | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content" | |
| android:fitsSystemWindows="true" | |
| android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> | |
| <android.support.design.widget.CollapsingToolbarLayout | |
| android:id="@+id/collapsing_toolbar" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:fitsSystemWindows="true" | |
| app:contentScrim="?attr/colorPrimary" | |
| app:expandedTitleMarginStart="20dp" | |
| app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"> | |
| <ImageView | |
| android:id="@+id/rssdetIcon" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:fitsSystemWindows="true" | |
| android:minHeight="160dp" | |
| android:scaleType="centerCrop" | |
| android:src="@drawable/burg1" | |
| app:layout_collapseMode="parallax" /> | |
| <android.support.v7.widget.Toolbar | |
| android:id="@+id/toolbar" | |
| android:layout_width="match_parent" | |
| android:layout_height="?attr/actionBarSize" | |
| app:layout_collapseMode="pin" | |
| app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> | |
| </android.support.design.widget.CollapsingToolbarLayout> | |
| </android.support.design.widget.AppBarLayout> | |
| <android.support.v4.widget.NestedScrollView | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:clipToPadding="false" | |
| app:layout_behavior="@string/appbar_scrolling_view_behavior" | |
| app:layout_constraintBottom_toBottomOf="parent" | |
| app:layout_constraintEnd_toEndOf="parent" | |
| app:layout_constraintStart_toStartOf="parent" | |
| app:layout_constraintTop_toTopOf="parent"> | |
| <android.support.constraint.ConstraintLayout | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content"> | |
| <TextView | |
| android:id="@+id/rssdetTitle" | |
| android:layout_width="0dp" | |
| android:layout_height="wrap_content" | |
| android:gravity="start" | |
| android:paddingBottom="2dp" | |
| android:paddingEnd="4dp" | |
| android:paddingStart="@dimen/activity_horizontal_margin" | |
| android:paddingTop="2dp" | |
| android:text="Title" | |
| android:textColor="@color/colorText" | |
| android:textSize="20sp" | |
| android:textStyle="bold" | |
| app:layout_constraintEnd_toEndOf="parent" | |
| app:layout_constraintStart_toStartOf="parent" | |
| app:layout_constraintTop_toTopOf="parent" /> | |
| <View | |
| android:id="@+id/rssdetDivTop" | |
| android:layout_width="0dp" | |
| android:layout_height="1px" | |
| android:background="@color/divider" | |
| app:layout_constraintEnd_toEndOf="parent" | |
| app:layout_constraintStart_toStartOf="parent" | |
| app:layout_constraintTop_toBottomOf="@id/rssdetTitle" /> | |
| <TextView | |
| android:id="@+id/rssdetPubDate" | |
| android:layout_width="0dp" | |
| android:layout_height="wrap_content" | |
| android:gravity="start" | |
| android:paddingBottom="2dp" | |
| android:paddingEnd="4dp" | |
| android:paddingStart="@dimen/activity_horizontal_margin" | |
| android:paddingTop="2dp" | |
| android:text="34 min ago" | |
| android:textColor="@color/colorTextSecondary" | |
| android:textSize="14sp" | |
| android:textStyle="bold" | |
| app:layout_constraintEnd_toEndOf="parent" | |
| app:layout_constraintStart_toStartOf="parent" | |
| app:layout_constraintTop_toBottomOf="@+id/rssdetDivTop" /> | |
| <View | |
| android:id="@+id/rssdetDivBottom" | |
| android:layout_width="0dp" | |
| android:layout_height="1px" | |
| android:background="@color/divider" | |
| app:layout_constraintEnd_toEndOf="parent" | |
| app:layout_constraintStart_toStartOf="parent" | |
| app:layout_constraintTop_toBottomOf="@id/rssdetPubDate" /> | |
| <TextView | |
| android:id="@+id/rssdetText" | |
| android:layout_width="0dp" | |
| android:layout_height="wrap_content" | |
| android:gravity="start" | |
| android:paddingBottom="2dp" | |
| android:paddingEnd="4dp" | |
| android:paddingStart="@dimen/activity_horizontal_margin" | |
| android:paddingTop="2dp" | |
| android:text="RSS is a type of web feed which allows users to access updates to online content in a standardized, computer-readable format. These feeds can, for example, allow a user to keep track of many different websites in a single news aggregator. The news aggregator will automatically check the RSS feed for new content. RSS is a type of web feed which allows users to access updates to online content in a standardized, computer-readable format. These feeds can, for example, allow a user to keep track of many different websites in a single news aggregator. The news aggregator will automatically check the RSS feed for new content. RSS is a type of web feed which allows users to access updates to online content in a standardized, computer-readable format. These feeds can, for example, allow a user to keep track of many different websites in a single news aggregator. The news aggregator will automatically check the RSS feed for new content" | |
| android:textColor="@color/colorTextSecondary" | |
| android:textSize="14sp" | |
| android:textStyle="bold" | |
| app:layout_constraintBottom_toBottomOf="parent" | |
| app:layout_constraintEnd_toEndOf="parent" | |
| app:layout_constraintStart_toStartOf="parent" | |
| app:layout_constraintTop_toBottomOf="@id/rssdetDivBottom" /> | |
| </android.support.constraint.ConstraintLayout> | |
| </android.support.v4.widget.NestedScrollView> | |
| </android.support.design.widget.CoordinatorLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // no actionbar! | |
| <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |
| <item name="colorPrimary">@color/colorPrimary</item> | |
| <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
| <item name="colorAccent">@color/colorAccent</item> | |
| <item name="windowActionBar">false</item> | |
| <item name="windowActionBarOverlay">true</item> | |
| <item name="windowNoTitle">true</item> | |
| <item name="android:windowBackground">@color/colorBackground</item> | |
| </style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment