android新拟态实现方法,Android 新拟态UI (Neumorphism)
前言
本文轉自github,只是進行了圖片的處理和部分翻譯,已獲作者授權
截至首次發文前找到的原作者的文章地址-May,17,2020若找到本文章更新的時間節點,請私信我更新。
原作者github地址
文末附源碼下載地址,免費。
Android上的擬態化UI
This is the experimental codes to build Neumorphism designs in Android.
Not a library. Just sample project now(目前只是示例項目).
Preview
Light | Dark
添加依賴
在項目級 build.gradle 添加以下依賴:
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
然后, 在 build.gradle中添加以下依賴
dependencies {
//截至首次發文前latest_version為0.3.0
implementation 'com.github.fornewid:neumorphism:{latest_version}'
}
Features
為組件繪制陰影實現新擬態化效果。
支持以下組件:
ViewGroup: CardView
View: Button, FloatingActionButton, ImageView
在Text上繪制陰影來實現TextView的新擬態化。
如果您需要更多功能或要修復錯誤,請單擊 new issue并報告給我!
// 預定義樣式
style="@style/Widget.Neumorph.CardView"
// 設置elevation和color
app:neumorph_shadowElevation="6dp"
app:neumorph_shadowColorLight="@color/solid_light_color"
app:neumorph_shadowColorDark="@color/solid_dark_color"
// 設置光源 lightSource
app:neumorph_lightSource="leftTop|leftBottom|rightTop|rightBottom"
// 設置Shape類型和corner size
app:neumorph_shapeType="{flat|pressed|basin}"
app:neumorph_shapeAppearance="@style/CustomShapeAppearance"
// 設置 background 或 stroke
app:neumorph_backgroundColor="@color/background_color"
app:neumorph_strokeColor="@color/stroke_color"
app:neumorph_strokeWidth="@dimen/stroke_width"
使用插圖以避免修剪陰影
// 使用 inset 以避免陰影被裁剪. (default=12dp)
app:neumorph_inset="12dp"
app:neumorph_insetStart="12dp"
app:neumorph_insetEnd="12dp"
app:neumorph_insetTop="12dp"
app:neumorph_insetBottom="12dp"
// Use a padding. (default=12dp)
android:padding="12dp">
{rounded|oval}
32dp
16dp
16dp
16dp
16dp
光源(LightSource)
LEFT_TOPLEFT_BOTTOMRIGHT_TOPRIGHT_BOTTOM
陰影類型(ShapeType)
FLATPRESSEDBASIN
License
Copyright 2020 SOUP
Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for
additional information regarding copyright ownership. The ASF licenses this
file to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
標簽:License,distributed,UI,16dp,under,Neumorphism,Android,擬態
來源: https://blog.csdn.net/qq_17282141/article/details/113945103
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的android新拟态实现方法,Android 新拟态UI (Neumorphism)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PostgreSQL extra_flo
- 下一篇: android listview rem