日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

Android修行手册 -初识Chip

發布時間:2023/12/14 Android 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Android修行手册 -初识Chip 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

本文約5.01千字,新手閱讀需要6分鐘,復習需要3分鐘收藏隨時查閱不再迷路

👉關于作者

眾所周知,人生是一個漫長的流程,不斷克服困難,不斷反思前進的過程。在這個過程中會產生很多對于人生的質疑和思考,于是我決定將自己的思考,經驗和故事全部分享出來,以此尋找共鳴 !!!
專注于Android/Unity和各種游戲開發技巧,以及各種資源分享(網站、工具、素材、源碼、游戲等)
有什么需要歡迎私我,交流群讓學習不再孤單

👉前提

這是小空堅持寫的Android新手向系列,歡迎品嘗。

大佬(×)

新手(√)

👉實踐過程

Chip控件是標簽,她和ChipGroup結合使用可以實現流式布局。原來實現流式布局都需要我們自定義,現在Android官方默認提供了控件,實現起來更方便了。

她倆都屬于material兼容包里的內容,截止目前2022年2月最新的Android Studio開發工具,material包都是默認導入的,如果你屬于老項目,那么去build.gradle中導入吧

😜前提使用條件

保障項目引入了material兼容包。

應用style中主題需要是MaterialComponents相關主題,僅這個前提就導致了該控件使用次數降低。

😜效果實例

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><com.google.android.material.chip.Chipandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="默認Chip" /><com.google.android.material.chip.Chipstyle="@style/Widget.MaterialComponents.Chip.Filter"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Chip-內置Filter樣式" /><com.google.android.material.chip.Chipstyle="@style/Widget.MaterialComponents.Chip.Entry"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Chip-內置Entry樣式" /><com.google.android.material.chip.Chipstyle="@style/Widget.MaterialComponents.Chip.Choice"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Chip-內置Choice樣式" /> </LinearLayout>

官方為我們提供了四個樣式:

  • 默認是Action樣式,只是普通標簽,無任何特殊效果。
  • 內置Filter樣式,具有選中效果,前方有選中圖標展示
  • 內置Entry樣式,具有選中效果,末尾一直顯示刪除圖表,點擊有選中圖標展示
  • 內置Choice樣式,具有選中效果,前后無圖標,有選中顏色變化效果

😜基本屬性

app:chipCornerRadius】:設置圓角半徑,從直角到圓角
app:chipMinHeight】:設置最小高度
app:chipBackgroundColor】:設置背景顏色
app:chipStrokeWidth】:設置邊線寬度
app:chipStrokeColor】:設置邊線顏色,需要chipStrokeWidth大于0
app:rippleColor】:水波紋顏色,就是點擊的瞬間那個動效顏色
app:chipIconVisible】:設置前面的圖標是否展示,控制的是app:chipIcon屬性的ICON
app:chipIcon】:設置文字前面的圖標
app:closeIcon】:設置文字后面的圖標,需要app:closeIconVisible屬性為true,默認false
app:closeIconSize】:設置文字后面圖標的大小
app:chipIconSize】:設置文字前面圖標的大小
app:closeIconTint】:設置文字后面圖標的前置著色
app:chipIconTint】:設置文字前面圖標的前置著色

<com.google.android.material.chip.Chipandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Chip-圓角半徑和最小寬度"app:chipCornerRadius="6dp"app:chipMinHeight="60dp" /> <com.google.android.material.chip.Chipandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Chip-背景顏色和邊線寬度及顏色"app:chipBackgroundColor="#ff0000"app:chipStrokeColor="#00ff00"app:chipStrokeWidth="3dp" /> <com.google.android.material.chip.Chipandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Chip-水波紋顏色和自定義Icon"app:chipIcon="@drawable/icon_xin"app:chipIconVisible="true"app:rippleColor="#0000ff" /> <com.google.android.material.chip.Chipandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Chip-圖標著色和圖標大小"app:chipIcon="@drawable/icon_xin"app:chipIconSize="40dp"app:chipIconTint="#00ff00"app:closeIcon="@drawable/icon_xinsui"app:closeIconSize="40dp"app:closeIconTint="#ff0000"app:closeIconVisible="true" />

👉其他

📢作者:小空和小芝中的小空
📢轉載說明-務必注明來源:https://zhima.blog.csdn.net/
📢這位道友請留步??,我觀你氣度不凡,談吐間隱隱有王者霸氣💚,日后定有一番大作為📝!!!旁邊有點贊👍收藏🌟今日傳你,點了吧,未來你成功??,我分文不取,若不成功??,也好回來找我。

溫馨提示點擊下方卡片獲取更多意想不到的資源。

總結

以上是生活随笔為你收集整理的Android修行手册 -初识Chip的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。