Skip to content

Instantly share code, notes, and snippets.

@kamikat
Last active June 8, 2016 08:46
Show Gist options
  • Save kamikat/1a92a4b2adea201d810905aec697ffbe to your computer and use it in GitHub Desktop.
Save kamikat/1a92a4b2adea201d810905aec697ffbe to your computer and use it in GitHub Desktop.
Draw a circle under the Android status bar
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="?attr/colorPrimary"/>
</shape>
</item>
<item android:gravity="right|center_vertical" android:width="200dp" android:height="200dp" android:right="30dp" android:top="-100dp" android:bottom="-100dp">
<shape android:shape="oval">
<solid android:color="?attr/colorAccent"/>
</shape>
</item>
</layer-list>
<android.support.design.widget.CoordinatorLayout
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:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:background="@drawable/bg_toolbar"
android:theme="@style/AppTheme.AppBarOverlay">
<!-- AppBarLayout will dispatch applyWindowInsets event to child view, use a FrameLayout to consumes that -->
<!-- https://github.com/hehonghui/android-tech-frontier/blob/master/issue-35/%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E4%BB%AC%E8%A6%81%E7%94%A8fitsSystemWindows.md -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</FrameLayout>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
<resources>
<string name="app_name">PlayFitSystemWindow</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#3949AB</item>
<item name="colorPrimaryDark">#43A047</item>
<item name="colorAccent">#FF5722</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
</resources>
<resources>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
</resources>
@kamikat
Copy link
Author

kamikat commented Jun 8, 2016

Preview

On Android N with split window feature & Android M

screen shot 2016-06-08 at 3 42 18 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment