Android MaterialShadowNinePatch 项目教程

随笔1周前发布 闷头走
17 0 0

Android MaterialShadowNinePatch 项目教程

android-materialshadowninepatchProvides 9-patch based drop shadow for view elements. Works on API level 9 or later.项目地址:https://gitcode.com/gh_mirrors/an/android-materialshadowninepatch

1. 项目的目录结构及介绍




android-materialshadowninepatch/


├── app/


│   ├── build.gradle


│   ├── src/


│   │   ├── main/


│   │   │   ├── java/


│   │   │   │   └── com/


│   │   │   │       └── h6ah4i/


│   │   │   │           └── android/


│   │   │   │               └── materialshadowninepatch/


│   │   │   │                   └── MainActivity.java


│   │   │   ├── res/


│   │   │   │   ├── layout/


│   │   │   │   │   └── activity_main.xml


│   │   │   │   ├── drawable/


│   │   │   │   ├── values/


│   │   │   │   │   └── strings.xml


│   │   │   │   └── ...


│   │   │   └── AndroidManifest.xml


│   │   └── ...


│   └── ...


├── library/


│   ├── build.gradle


│   ├── src/


│   │   ├── main/


│   │   │   ├── java/


│   │   │   │   └── com/


│   │   │   │       └── h6ah4i/


│   │   │   │           └── android/


│   │   │   │               └── materialshadowninepatch/


│   │   │   │                   └── MaterialShadowContainerView.java


│   │   │   ├── res/


│   │   │   │   ├── drawable/


│   │   │   │   ├── values/


│   │   │   │   │   └── attrs.xml


│   │   │   │   └── ...


│   │   │   └── AndroidManifest.xml


│   │   └── ...


│   └── ...


├── build.gradle


├── settings.gradle


└── ...

目录结构介绍

app/: 包含示例应用的代码和资源文件。

build.gradle: 应用模块的构建脚本。src/main/java/com/h6ah4i/android/materialshadowninepatch/: 包含示例应用的主要Java代码。src/main/res/: 包含示例应用的资源文件,如布局、字符串等。src/main/AndroidManifest.xml: 应用的清单文件。

library/: 包含库模块的代码和资源文件。

build.gradle: 库模块的构建脚本。src/main/java/com/h6ah4i/android/materialshadowninepatch/: 包含库的主要Java代码。src/main/res/: 包含库的资源文件,如自定义属性等。src/main/AndroidManifest.xml: 库的清单文件。

build.gradle: 项目的根构建脚本。

settings.gradle: 项目的设置文件,用于包含各个模块。

2. 项目的启动文件介绍

MainActivity.java




package com.h6ah4i.android.materialshadowninepatch;


 


import android.os.Bundle;


import androidx.appcompat.app.AppCompatActivity;


 


public class MainActivity extends AppCompatActivity {


    @Override


    protected void onCreate(Bundle savedInstanceState) {


        super.onCreate(savedInstanceState);


        setContentView(R.layout.activity_main);


    }


}

activity_main.xml




<com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView


    xmlns:android="http://schemas.android.com/apk/res/android"


    xmlns:app="http://schemas.android.com/apk/res-auto"


    style="@style/ms9_DefaultShadowStyle"


    android:id="@+id/shadow_item_container"


    android:layout_width="wrap_content"


    android:layout_height="wrap_content"


    app:ms9_shadowTranslationZ="2dp"


    app:ms9_shadowElevation="4dp">


    <TextView


        android:layout_width="wrap_content"


        android:layout_height="wrap_content"



android-materialshadowninepatchProvides 9-patch based drop shadow for view elements. Works on API level 9 or later.项目地址:https://gitcode.com/gh_mirrors/an/android-materialshadowninepatch

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...