{"id":13396424,"url":"https://github.com/h6ah4i/android-materialshadowninepatch","last_synced_at":"2025-04-13T00:48:28.214Z","repository":{"id":27348180,"uuid":"30823285","full_name":"h6ah4i/android-materialshadowninepatch","owner":"h6ah4i","description":"Provides 9-patch based drop shadow for view elements. Works on API level 9 or later.","archived":false,"fork":false,"pushed_at":"2021-02-11T01:41:58.000Z","size":753,"stargazers_count":481,"open_issues_count":5,"forks_count":63,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-04-13T00:48:19.967Z","etag":null,"topics":["android","drop-shadow","material-design"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/h6ah4i.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-15T09:30:32.000Z","updated_at":"2024-11-06T02:44:21.000Z","dependencies_parsed_at":"2022-08-31T18:33:03.493Z","dependency_job_id":null,"html_url":"https://github.com/h6ah4i/android-materialshadowninepatch","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h6ah4i%2Fandroid-materialshadowninepatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h6ah4i%2Fandroid-materialshadowninepatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h6ah4i%2Fandroid-materialshadowninepatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/h6ah4i%2Fandroid-materialshadowninepatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/h6ah4i","download_url":"https://codeload.github.com/h6ah4i/android-materialshadowninepatch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650437,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","drop-shadow","material-design"],"created_at":"2024-07-30T18:00:50.915Z","updated_at":"2025-04-13T00:48:28.191Z","avatar_url":"https://github.com/h6ah4i.png","language":"Java","funding_links":[],"categories":["Index `(light-weight pages)`","Index","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"readme":"Material Shadow 9-Patch\n===============\n\nThis library provides 9-patch based drop shadow for view elements. Works on API level 14 or later.\n\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Material%20Shadow%209--Patch-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1562)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.h6ah4i.android.materialshadowninepatch/materialshadowninepatch/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.h6ah4i.android.widget.verticalseekbar/verticalseekbar)\n\n---\n\n\u003ca href=\"./pic/ics.png?raw=true\"\u003e\u003cimg src=\"./pic/ics.png?raw=true\" alt=\"Example on Android 4.0\" width=\"200\" /\u003e\u003c/a\u003e\n\u003ca href=\"./pic/lollipop.png?raw=true\"\u003e\u003cimg src=\"./pic/lollipop.png?raw=true\" alt=\"Example on Android 5.0\" width=\"200\" /\u003e\u003c/a\u003e\n\n---\n\nTarget platforms\n---\n\n- API level 14 or later\n\n\nLatest version\n---\n\n- Version 1.0.0 (September 25, 2018)\n\nGetting started\n---\n\nThis library is published on Maven Central. Just add these lines to `build.gradle`.\n\n```groovy\ndependencies {\n    compile 'com.h6ah4i.android.materialshadowninepatch:materialshadowninepatch:1.0.0'\n}\n```\n\nUsage\n---\n\n### Layout XML\n\n```xml\n\u003ccom.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    style=\"@style/ms9_DefaultShadowStyle\"\n    android:id=\"@+id/shadow_item_container\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    app:ms9_shadowTranslationZ=\"2dp\"\n    app:ms9_shadowElevation=\"4dp\"\u003e\n\n    \u003c!-- NOTE 1: only 1 child can be accepted --\u003e\n    \u003c!-- NOTE 2: margins are required to draw shadow properly --\u003e\n    \u003cTextView\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_marginLeft=\"8dp\"\n        android:layout_marginTop=\"8dp\"\n        android:layout_marginRight=\"8dp\"\n        android:layout_marginBottom=\"8dp\"\n        android:background=\"@android:color/white\"\n        android:text=\"Inner content view\" /\u003e\n\n\u003c/com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView\u003e\n```\n\n### Java code\n\n```java\nMaterialShadowContainerView shadowView =\n        (MaterialShadowContainerView) findViewById(R.id.shadow_item_container);\n\nfloat density = getResources().getDisplayMetrics().density;\n\nshadowView.setShadowTranslationZ(density * 2.0f); // 2.0 dp\nshadowView.setShadowElevation(density * 4.0f); // 4.0 dp\n```\n\nAdvanced Usages\n---\n\n```xml\n\u003ccom.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    style=\"@style/ms9_DefaultShadowStyle\"\n    android:id=\"@+id/shadow_item_container\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    app:ms9_shadowTranslationZ=\"2dp\"\n    app:ms9_shadowElevation=\"4dp\"\n    app:ms9_useAmbientShadow=\"true\"\n    app:ms9_useSpotShadow=\"true\"\n    app:ms9_forceUseCompatShadow=\"true\"\n    app:ms9_affectsDisplayedPosition=\"true\"\n    app:ms9_spotShadowDrawablesList=\"@array/ms9_spot_shadow_drawables_z18\"\n    app:ms9_ambientShadowDrawablesList=\"@array/ms9_ambient_shadow_drawables_z18\"\u003e\n\n    ...\n\n\u003c/com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView\u003e\n```\n\n| Property name                    | Default                               | Description                                                             |\n|----------------------------------|---------------------------------------|-------------------------------------------------------------------------|\n| `ms9_shadowTranslationZ`         | `0dp`                                 | Compatibility version of `android:translationZ`                         |\n| `ms9_shadowElevation`            | `0dp`                                 | Compatibility version of `android:elevation`                            |\n| `ms9_forceUseCompatShadow`       | `false`                               | Enforces to use compatibility shadow on Lollipop or later               |\n| `ms9_affectsDisplayedPosition`   | `true`                                | Specify whether the shadow position is affected by the target view's position (emulates Lollipop's behavior) |\n| `app:ms9_useAmbientShadow`       | `true`                                | Specify whether to use ambient shadow                                   |\n| `app:ms9_useSpotShadow`          | `true`                                | Specify whether to use spot shadow                                      |\n| `ms9_spotShadowDrawablesList`    | `@array/ms9_spot_shadow_drawables`    | Specify *Spot shadow (Key shadow)* 9-patch resources                    |\n| `ms9_ambientShadowDrawablesList` | `@array/ms9_ambient_shadow_drawables` | Specify *Ambient shadow* 9-patch resources                              |\n\n\n| Style name                                           |                                                                            |\n|------------------------------------------------------|----------------------------------------------------------------------------|\n| `ms9_DefaultShadowStyle([ Z6 or Z9 orZ18 ])`                             | Default style (uses spot \u0026 ambient shadow, position affects)               |\n| `ms9_DefaultShadowStyle([ Z6 or Z9 or Z18 ])CompatOnly`                   | Default style with `ms9_forceUseCompatShadow=\"true\"`                       |\n| `ms9_NoDisplayedPositionAffectShadowStyle([ Z6 or Z9 or Z18 ])`           | No displayed position affects style                                        |\n| `ms9_NoDisplayedPositionAffectShadowStyle([ Z6 or Z9 or Z18 ])CompatOnly` | No displayed position affects style with `ms9_forceUseCompatShadow=\"true\"` |\n| `ms9_CompositeShadowStyle([ Z6 or Z9 ])`                                 | Pre-composite shadow style (**less overdraws**)                            |\n| `ms9_CompositeShadowStyle([ Z6 or Z9 ])CompatOnly`                       | Pre-composite shadow style with `ms9_forceUseCompatShadow=\"true\"`          |\n\n*NOTE: You can specify `Z[6|9|18]` suffix for style names. This limits the deepest limit of shadow nine patch resources and it makes resource shrinking (`shrinkResources true`) work more effectively!*\n\nLicense\n---\n\nThis library is licensed under the [Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).\n\nSee [`LICENSE`](LICENSE) for full of the license text.\n\n    Copyright (C) 2015 Haruki Hasegawa\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh6ah4i%2Fandroid-materialshadowninepatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fh6ah4i%2Fandroid-materialshadowninepatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh6ah4i%2Fandroid-materialshadowninepatch/lists"}