Starting from Android 5.0 (API level 21), View provides an attribute called "elevation" to set the size of the shadow. This attribute can be set through XML or code. Note that the size of the shadow is related to the Z value (elevation) and translationZ attribute of the View. The Z value is determined by elevation and translationZ. Usually elevation is used for static shadows, while translationZ is used for animations. XML settings: Code settings: In the Material Design specification, there are two light sources, one is point light source, the other is ambient light. The two light sources work together to form the shadow effect of the View. By default, the shadow is black, but many times we want the shadow color to be consistent with the color of the View itself to achieve a better visual effect. Android considerately considers this and provides us with the API: setOutlineAmbientShadowColor and setOutlineSpotShadowColor. Developers can change the color of the shadow through XML or code. "setOutlineAmbientShadowColor"
XML settings: Code settings: "setOutlineSpotShadowColor"
XML settings: Code settings: Other options for setting shadows:
|
<<: Hongmeng's rise is a victory for long-termists
>>: iOS 17.3 battery life test for various devices, a retirement version!
Douyu, which was launched in 2014, has been devel...
Reviewer of this article: Xu Qibin, associate chi...
In the process of bidding promotion , I believe t...
1 The predecessor of Kuaishou, called "GIF K...
1. Case Study Xiao Ming has been signing in at a ...
This article was reviewed by: Xiaobo Zhou, Doctor...
Through new media operations, we can complete bra...
Course Catalog: 01 【Editorial】Resolve workplace d...
I believe everyone is familiar with " PUA &q...
You may only notice the existence of Apple's ...
With a dataset of 3 million images and 15,000 zeb...
Jobs said that consumers don’t know what they nee...
Mixed knowledge, Specially designed to cure confu...
The annual Alipay Five Blessings Collection has f...
Recently, Kuaishou APP announced that it will pro...