This control is extracted fromQMUI,You can adjust the depth, area, and fillet of the control's shadow
Invalid shadows in Android 4.4 and below
First add in the repositories of build.gradle :
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Then add in dependencies:
dependencies {
// AndroidX
implementation 'com.github.limuyang2:LShadowLayout:1.0.7'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
}
if you use Android Support
,Please use the following:
dependencies {
implementation 'com.github.limuyang2:LShadowLayout:1.0.3'
}
The controls already included in this library are:
ShadowLinearLayout
ShadowRelativeLayout
ShadowConstraintLayout
ShadowFrameLayout
Simply replace the corresponding layout in the project.
E.g:
<top.limuyang2.shadowlayoutlib.ShadowLinearLayout
…………
android:background="#fff"
android:padding="12dp"
app:l_radius="3dp" //Rounded corner size
app:l_shadowAlpha="0.2" //Shadow alpha
app:l_shadowElevation="5dp" //Shadow value >
</top.limuyang2.shadowlayoutlib.ShadowLinearLayout>
More properties, please see the source code
2018 limuyang
Licensed 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.