android新拟态实现方法,Android 新拟态UI (Neumorphism)
前言
本文轉(zhuǎn)自github,只是進(jìn)行了圖片的處理和部分翻譯,已獲作者授權(quán)
截至首次發(fā)文前找到的原作者的文章地址-May,17,2020若找到本文章更新的時(shí)間節(jié)點(diǎn),請(qǐng)私信我更新。
原作者github地址
文末附源碼下載地址,免費(fèi)。
Android上的擬態(tài)化UI
This is the experimental codes to build Neumorphism designs in Android.
Not a library. Just sample project now(目前只是示例項(xiàng)目).
Preview
Light | Dark
添加依賴(lài)
在項(xiàng)目級(jí) build.gradle 添加以下依賴(lài):
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
然后, 在 build.gradle中添加以下依賴(lài)
dependencies {
//截至首次發(fā)文前l(fā)atest_version為0.3.0
implementation 'com.github.fornewid:neumorphism:{latest_version}'
}
Features
為組件繪制陰影實(shí)現(xiàn)新擬態(tài)化效果。
支持以下組件:
ViewGroup: CardView
View: Button, FloatingActionButton, ImageView
在Text上繪制陰影來(lái)實(shí)現(xiàn)TextView的新擬態(tài)化。
如果您需要更多功能或要修復(fù)錯(cuò)誤,請(qǐng)單擊 new issue并報(bào)告給我!
// 預(yù)定義樣式
style="@style/Widget.Neumorph.CardView"
// 設(shè)置elevation和color
app:neumorph_shadowElevation="6dp"
app:neumorph_shadowColorLight="@color/solid_light_color"
app:neumorph_shadowColorDark="@color/solid_dark_color"
// 設(shè)置光源 lightSource
app:neumorph_lightSource="leftTop|leftBottom|rightTop|rightBottom"
// 設(shè)置Shape類(lèi)型和corner size
app:neumorph_shapeType="{flat|pressed|basin}"
app:neumorph_shapeAppearance="@style/CustomShapeAppearance"
// 設(shè)置 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
陰影類(lèi)型(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.
標(biāo)簽:License,distributed,UI,16dp,under,Neumorphism,Android,擬態(tài)
來(lái)源: https://blog.csdn.net/qq_17282141/article/details/113945103
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的android新拟态实现方法,Android 新拟态UI (Neumorphism)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: PostgreSQL extra_flo
- 下一篇: bsgs(Baby Steps Gian