91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Android如何實現Neumorphism?UI控件

發布時間:2022-02-20 09:00:25 來源:億速云 閱讀:438 作者:小新 欄目:開發技術

小編給大家分享一下Android如何實現Neumorphism UI控件,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

效果圖

Android如何實現Neumorphism?UI控件

Android如何實現Neumorphism?UI控件

Android如何實現Neumorphism?UI控件

第三方庫支持

Github:https://github.com/fornewid/neumorphism

代碼示例

將介紹第三方庫引入和xml布局

引入第三方庫

引入jitpack.io,添加到工程級build.gradle,若是Kotlin項目工程則在 settings.gradle 中引入

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

在項目中引入

//新擬物化風格
implementation 'com.github.fornewid:neumorphism:0.3.2'

黑暗模式布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#1A1A1A"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    tools:context=".activity.TestActivity">

    <soup.neumorphism.NeumorphCardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="50dp"
        app:neumorph_shadowColorDark="#0E0E0E"
        app:neumorph_shadowColorLight="#202020">

        <LinearLayout
            android:layout_width="316dp"
            android:layout_height="200dp"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dp"
                android:layout_marginTop="10dp"
                android:text="程序員銀行"
                android:textColor="#2E2E2E"
                android:textSize="18sp" />

            <soup.neumorphism.NeumorphTextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dp"
                android:layout_marginTop="100dp"
                android:text="898989 1234567890 "
                android:textColor="#1A1A1A"
                android:textSize="26sp"
                android:textStyle="bold"
                app:neumorph_shadowColorDark="#0E0E0E"
                app:neumorph_shadowColorLight="#202020" />

        </LinearLayout>

    </soup.neumorphism.NeumorphCardView>

    <soup.neumorphism.NeumorphTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginVertical="20dp"
        android:text="This is Text "
        android:textColor="#1A1A1A"
        android:textSize="26sp"
        android:textStyle="bold"
        app:neumorph_shadowColorDark="#0E0E0E"
        app:neumorph_shadowColorLight="#202020" />

    <soup.neumorphism.NeumorphButton
        android:id="@+id/btn1"
        android:layout_width="150dp"
        android:layout_height="65dp"
        android:gravity="center"
        android:text="靈魂按鈕"
        android:textColor="#5E5E5E"
        app:neumorph_shadowColorDark="#0E0E0E"
        app:neumorph_shadowColorLight="#202020" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">

        <soup.neumorphism.NeumorphCardView
            android:layout_width="100dp"
            android:layout_height="100dp"
            app:neumorph_shadowColorDark="#0E0E0E"
            app:neumorph_shadowColorLight="#202020" />

        <soup.neumorphism.NeumorphCardView
            android:layout_width="100dp"
            android:layout_height="100dp"
            app:neumorph_shadowColorDark="#0E0E0E"
            app:neumorph_shadowColorLight="#202020"
            app:neumorph_shapeType="basin"
            app:neumorph_strokeColor="#1A1A1A"
            app:neumorph_strokeWidth="8dp" />

        <soup.neumorphism.NeumorphCardView
            android:layout_width="100dp"
            android:layout_height="100dp"
            app:neumorph_shadowColorDark="#0E0E0E"
            app:neumorph_shadowColorLight="#202020"
            app:neumorph_shapeType="pressed" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">

        <soup.neumorphism.NeumorphFloatingActionButton
            android:layout_width="100dp"
            android:layout_height="100dp"
            app:neumorph_shadowColorDark="#0E0E0E"
            app:neumorph_shadowColorLight="#202020" />

        <soup.neumorphism.NeumorphImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_marginHorizontal="15dp"
            android:padding="25dp"
            android:scrollbarSize="15sp"
            android:src="@mipmap/face"
            app:neumorph_shadowColorDark="#0E0E0E"
            app:neumorph_shadowColorLight="#202020" />

        <soup.neumorphism.NeumorphFloatingActionButton
            android:layout_width="100dp"
            android:layout_height="100dp"
            app:neumorph_shadowColorDark="#0E0E0E"
            app:neumorph_shadowColorLight="#202020"
            app:neumorph_shapeType="pressed" />

    </LinearLayout>


</LinearLayout>

明亮風格

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#F3F3F3"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    tools:context=".activity.TestActivity">

    <soup.neumorphism.NeumorphCardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="50dp">

        <LinearLayout
            android:layout_width="316dp"
            android:layout_height="200dp"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dp"
                android:layout_marginTop="10dp"
                android:text="程序員銀行"
                android:textColor="#999999"
                android:textSize="18sp" />

            <soup.neumorphism.NeumorphTextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dp"
                android:layout_marginTop="100dp"
                android:text="898989 1234567890 "
                android:textColor="#F3F3F3"
                android:textSize="26sp"
                android:textStyle="bold"
                app:neumorph_shapeType="pressed" />

        </LinearLayout>

    </soup.neumorphism.NeumorphCardView>

    <soup.neumorphism.NeumorphTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginVertical="20dp"
        android:text="This is Text "
        android:textColor="#F3F3F3"
        android:textSize="26sp"
        android:textStyle="bold" />

    <soup.neumorphism.NeumorphButton
        android:id="@+id/btn1"
        android:layout_width="150dp"
        android:layout_height="65dp"
        android:gravity="center"
        android:text="靈魂按鈕"
        android:textColor="#999999" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">

        <soup.neumorphism.NeumorphCardView
            android:layout_width="100dp"
            android:layout_height="100dp" />

        <soup.neumorphism.NeumorphCardView
            android:layout_width="100dp"
            android:layout_height="100dp"
            app:neumorph_shapeType="basin"
            app:neumorph_strokeColor="#F3F3F3"
            app:neumorph_strokeWidth="8dp" />

        <soup.neumorphism.NeumorphCardView
            android:layout_width="100dp"
            android:layout_height="100dp"
            app:neumorph_shapeType="pressed" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">

        <soup.neumorphism.NeumorphFloatingActionButton
            android:layout_width="100dp"
            android:layout_height="100dp" />

        <soup.neumorphism.NeumorphImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_marginHorizontal="15dp"
            android:padding="25dp"
            android:scrollbarSize="15sp"
            android:src="@mipmap/face" />

        <soup.neumorphism.NeumorphFloatingActionButton
            android:layout_width="100dp"
            android:layout_height="100dp"
            app:neumorph_shapeType="pressed" />

    </LinearLayout>


</LinearLayout>

文檔說明(案例)

<soup.neumorphism.NeumorphCardView

    <!--預定義樣式-->
    

   <!--設置陰影高度和顏色-->
    app:neumorph_shadowElevation="6dp"
    app:neumorph_shadowColorLight="@color/solid_light_color"
    app:neumorph_shadowColorDark="@color/solid_dark_color"

    <!--設置光源-->
    app:neumorph_lightSource="leftTop|leftBottom|rightTop|rightBottom"

    <!--設置形狀類型和角尺寸-->
    app:neumorph_shapeType="{flat|pressed|basin}"
    app:neumorph_shapeAppearance="@style/CustomShapeAppearance"

    <!--設置背景或描邊-->
    app:neumorph_backgroundColor="@color/background_color"
    app:neumorph_strokeColor="@color/stroke_color"
    app:neumorph_strokeWidth="@dimen/stroke_width"

    <!--使用插圖來避免剪裁陰影。 (默認為12dp)-->
    app:neumorph_inset="12dp"
    app:neumorph_insetStart="12dp"
    app:neumorph_insetEnd="12dp"
    app:neumorph_insetTop="12dp"
    app:neumorph_insetBottom="12dp"

    <!--使用填充,默認為12db-->
    android:padding="12dp">

	<!--在這里可以直接包裹子布局-->

   
</soup.neumorphism.NeumorphCardView>

<style name="CustomShapeAppearance">
    <item name="neumorph_cornerFamily">{rounded|oval}</item>
    <item name="neumorph_cornerSize">32dp</item>

    <!-- Or if wants different radii depending on the corner. -->
    <item name="neumorph_cornerSizeTopLeft">16dp</item>
    <item name="neumorph_cornerSizeTopRight">16dp</item>
    <item name="neumorph_cornerSizeBottomLeft">16dp</item>
    <item name="neumorph_cornerSizeBottomRight">16dp</item>
</style>

以上是“Android如何實現Neumorphism UI控件”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

长治市| 广安市| 澜沧| 琼中| 治县。| 江西省| 任丘市| 白银市| 贺兰县| 永清县| 漳州市| 嘉鱼县| 高密市| 玉树县| 涞源县| 和林格尔县| 益阳市| 神木县| 武山县| 七台河市| 道孚县| 临高县| 威信县| 精河县| 治多县| 汕尾市| 武汉市| 高阳县| 府谷县| 德化县| 江达县| 龙南县| 湟源县| 博兴县| 大方县| 新巴尔虎左旗| 衡南县| 丘北县| 车致| 金湖县| 景洪市|