http://www.itdecent.cn/p/47a4a7b99364
標題隱含了兩個層面的意思,一個是主流,另一個是UI。主流既通用,一些常規(guī)的按鈕、Switch、進度條等控件都是通用控件,因此本文將其囊括,但一些很炫酷但不通用的控件除外。UI不僅包括控件,還包括效果、動畫甚至是一些UI輔助類庫等。
網(wǎng)上有不少對開源項目進行整理的文章,以下兩個最為知名:
https://github.com/Trinea/android-open-project
囊括了非常多的、各式各樣的開源項目,包括但不限于UI、工具類庫等。
https://github.com/wasabeef/awesome-android-ui
囊括了非常多的、各種類型的UI開源庫。
本文的取材大部分來自這兩篇文章,在此感謝文章作者的辛勤付出。更要感謝的是那些無私奉獻代碼的Opener。
主流UI分類
既然是整理,那先得有一個分類,分類如下:
按鈕
Switch(開關)
編輯框(類EditText)
文本控件(類TextView)
進度條(圈)等展示進度相關
拖動條(類SeekBar)
RatingBar
列表、網(wǎng)格、瀑布流控件
對話框(Dialog、BottomSheet等)
日歷、時間選擇
分類篩選
角標、徽章
圖表
富文本編輯、代碼高亮等
圖片展示(類ImageView)
標簽組控件(類FlowLayout)
App新手引導、高亮
側邊欄索引、固定Header
菜單(類Menu,但不包括側滑菜單)
通用下拉刷新、加載更多
廣告輪播、垂直公告
滑動返回(類SwipeBack)
指示器、Tab
動畫相關庫
側滑菜單(類SlidingMenu)
輔助類庫
目前想到的通用控件種類就這么多,如有遺漏,歡迎指正哈。
主流UI開源庫
以下是對上述分類的一一展開。我會列出每個分類下的熱門開源項目,并適當?shù)慕o出介紹。這些項目按照我所認為的通用性降序排列,排在越前面的說明通用性、實用性越高,但并不代表star就越多。有些項目有幾千個star,效果看起來也很酷,但通用性很差,顯得有些雞肋,就靠后排列了,甚至介紹都免了。
按鈕
https://github.com/hoang8f/android-flat-button
很適合做扁平化、純色的按鈕,支持陰影。
https://github.com/Bearded-Hen/Android-Bootstrap
BootStrap風格的按鈕,做過前端的同學應該都知道。
https://github.com/dmytrodanylyk/circular-progress-button
可以顯示進度的按鈕,適用于點擊按鈕后執(zhí)行一個長時間操作,此時可直接在按鈕上顯示進度。
https://github.com/dmytrodanylyk/android-process-button
可以顯示進度的按鈕。同上。
Switch(開關)
https://github.com/kyleduo/SwitchButton
各式各樣風格的Switch,總有一個適合你。
https://github.com/Nightonke/JellyToggleButton
帶有彈性效果的Switch。
編輯框(類EditText)
https://github.com/rengwuxian/MaterialEditText
Material Design風格的EditText。
https://github.com/mabbas007/TagsEditText
以標簽形式展示的EditText。
https://github.com/g707175425/CloudEditText
以標簽形式展示的EditText。
https://github.com/vekexasia/android-edittext-validator
帶錯誤校驗和提示的EditText。
https://github.com/qinci/AndroidEdit
為EditText提供撤銷、反撤銷功能。
文本控件(類TextView)
https://github.com/Manabu-GT/ExpandableTextView
可折疊的TextView,類似朋友圈查看全文。
https://github.com/grantland/android-autofittextview
自適應的TextView,在寬高固定的情況下,文字越多,字體越小。
https://github.com/rockerhieu/emojicon
支持emoji表情的TextView。
https://github.com/hanks-zyh/HTextView
支持很多文本特效的TextView,很贊。
進度條(圈)等展示進度相關
https://github.com/DreaminginCodeZH/MaterialProgressBar
Material Design風格的ProgressBar,支持多種效果。
https://github.com/hongyangAndroid/Android-ProgressBarWidthNumber
鴻洋大牛的作品,值得擁有。
https://github.com/daimajia/NumberProgressBar
代碼家大牛的作品。
https://github.com/lopspower/CircularProgressBar
很實用的進度條,雖然只有一種效果。
https://github.com/dinuscxj/LoadingDrawable
各式各樣創(chuàng)意、風格奇特的進度條。
https://github.com/akexorcist/Android-RoundCornerProgressBar
一個圓乎乎的、多彩的進度條。
拖動條(類SeekBar)
https://github.com/AnderWeb/discreteSeekBar
拖拽時可顯示氣泡提示的SeekBar。
https://github.com/oli107/material-range-bar
Material Design風格的、支持區(qū)間選取的SeekBar。
RatingBar
https://github.com/DreaminginCodeZH/MaterialRatingBar
Material Design風格的RatingBar。
列表、網(wǎng)格、瀑布流控件
RecyclerView
這個就不用解釋了,使用請參考Android RecyclerView 使用完全解析 體驗藝術般的控件。
對于列表、網(wǎng)格的拖拽排序、側滑刪除,推薦使用RecyclerView來做,可參考https://github.com/YoKeyword/ItemTouchHelperDemo。
對話框(Dialog、BottomSheet等)
https://github.com/H07000223/FlycoDialog_Master
一套強大的Dialog集合,提供了類似BottomSheet的效果。
https://github.com/afollestad/material-dialogs
功能強大、支持各式各樣風格的Dialog。
https://github.com/drakeet/MaterialDialog
一套Material Design風格的對話框。
https://github.com/orhanobut/dialogplus
實現(xiàn)對話框的另一種選擇。
日歷、時間選擇
https://github.com/philliphsu/BottomSheetPickers
非常不錯的日歷、時間選擇控件。
https://github.com/vikramkakkar/SublimePicker
清爽、漂亮的日歷。
https://github.com/wdullaer/MaterialDateTimePicker
Material Design風格的日歷、時間選擇器。
https://github.com/borax12/MaterialDateRangePicker
效果和MaterialDateTimePicker幾乎一樣,不知道是不是抄的,提供了日歷、時間區(qū)間的選擇。
https://github.com/traex/CalendarListview
基于ListView,效果類似原生Android的日歷。
https://github.com/square/android-times-square
來自square的日歷選擇器。
分類篩選
https://github.com/dongjunkun/DropDownMenu
一個實用的多條件篩選菜單。
角標、徽章
https://github.com/HeZaiJin/SlantedTextView
用TextView實現(xiàn)的標簽效果,值得一試。
https://github.com/stefanjauker/BadgeView
給特定的View添加角標效果。
https://github.com/leolin310148/ShortcutBadger
用來生成帶有角標的圖標。
圖表
https://github.com/xcltapestry/XCL-Charts
支持數(shù)十種圖表,總有一個適合你。
https://github.com/lecho/hellocharts-android
功能強大、支持各式各樣的圖表控件。
https://github.com/PhilJay/MPAndroidChart
強大、易于使用的圖表控件。
https://github.com/diogobernardino/WilliamChart
富文本編輯、代碼高亮等
https://github.com/wasabeef/richeditor-android
功能強大的富文本編輯器。
https://github.com/mthli/Knife
輕量級的富文本編輯器。
https://github.com/Thereisnospon/CodeView
強大的代碼高亮控件,支持多種語言。
圖片展示(類ImageView)
https://github.com/chrisbanes/PhotoView
強大的、人盡皆知的圖片瀏覽控件。
https://github.com/hdodenhof/CircleImageView
用來顯示圓角圖片的ImageView。
https://github.com/siyamed/android-shape-imageview
將圖片按照自定義的形狀顯示。
https://github.com/amulyakhare/TextDrawable
以Drawable的形式顯示字符,類似平時見到的“字符”頭像。
https://github.com/chengdazhi/StyleImageView
能實現(xiàn)簡單的圖像處理的ImageView。
標簽組控件(類FlowLayout)
https://github.com/BelooS/ChipsLayoutManager
基于RecyclerView實現(xiàn)的標簽控件。
https://github.com/hongyangAndroid/FlowLayout
鴻洋大牛的作品,支持單選、多選。
App新手引導、高亮
https://github.com/amlcurran/ShowcaseView
老牌的引導高亮庫。
https://github.com/KeepSafe/TapTargetView
Material Design風格的高亮庫。
https://github.com/hongyangAndroid/Highlight
一個引導高亮的庫,來自鴻洋。
https://github.com/jaydenxiao2016/HighLightGuideView
又一個引導高亮庫。
https://github.com/matrixxun/ProductTour
非??岬囊龑ы撔Ч?/p>
https://github.com/rahulrj/YahooNewsOnboarding
https://github.com/sacot41/SCViewPager
https://github.com/paolorotolo/AppIntro
一個比較炫酷的引導頁框架。
側邊欄索引、固定Header
https://github.com/beworker/pinned-section-listview
固定Header的ListView。
https://github.com/emilsjolander/StickyListHeaders
老牌的、固定Header的ListView。
https://github.com/timehop/sticky-headers-recyclerview
固定Header的RecyclerView。支持橫向、縱向。
菜單(類Menu,但不包括側滑菜單)
https://github.com/futuresimple/android-floating-action-button
大名鼎鼎的fab。
https://github.com/linroid/FilterMenu
一個轉盤式菜單。
https://github.com/ShamylZakariya/FlyoutMenus
一個很酷的彈出菜單。
https://github.com/ogaclejapan/ArcLayout
弧形菜單,支持多種效果。
https://github.com/oguzbilgener/CircularFloatingActionMenu
炫酷的弧形菜單,支持自定義動畫。
通用下拉刷新、加載更多
https://github.com/liaohuqiu/android-Ultra-Pull-To-Refresh
廖祜秋大牛的下拉刷新框架,支持對任意View做下拉刷新,也僅限于做下拉刷新。
SwipeRefreshLayout
官方的、Material Design風格的下拉刷新框架。
https://github.com/chrisbanes/Android-PullToRefresh
老牌的下拉刷新框架,已廢棄。
那些只能對特定View做下拉刷新、上拉加載的非通用框架就不貼了。
廣告輪播、垂直公告
https://github.com/saiwu-bigkoo/Android-ConvenientBanner
基于ViewPager的廣告輪播控件,支持循環(huán)滾動。
https://github.com/H07000223/FlycoBanner_Master
又一個廣告輪播控件。
https://github.com/sfsheng0322/MarqueeView
基于ViewFlipper的垂直公告控件。
滑動返回(類SwipeBack)
https://github.com/ikew0ng/SwipeBackLayout
老牌的滑動返回框架,需要結合透明主題,Activity不宜過多,否則卡頓嚴重。
https://github.com/YoKeyword/SwipeBackFragment
支持滑動返回的Fragment。
https://github.com/XBeats/and_swipeback
另一個滑動返回框架,無需設置透明主題。
指示器、Tab
https://github.com/hackware1993/MagicIndicator
強大、可定制、易擴展的 ViewPager 指示器框架。
https://github.com/H07000223/FlycoTabLayout
https://github.com/ogaclejapan/SmartTabLayout
https://github.com/romandanylyk/PageIndicatorView
支持多種小圈小點的指示器。
https://github.com/ongakuer/CircleIndicator
TabLayout
總所周知的Tab框架,唯一的優(yōu)勢是來自官方。
動畫相關庫
https://github.com/wasabeef/recyclerview-animators
一系列RecyclerView Item動畫合集。
https://github.com/nhaarman/ListViewAnimations
一系列ListView Item動畫合集。已廢棄,推薦使用RecyclerView。
https://github.com/daimajia/AndroidViewAnimations
老牌的View動畫合集。來自代碼家
https://github.com/gabrielemariotti/RecyclerViewItemAnimators
又一個ReyclerView Item動畫合集。
https://github.com/lgvalle/Material-Animations
一系列Material Design風格的動畫合集。
https://github.com/jfeinstein10/JazzyViewPager
一系列的PageTransformer合集。
https://github.com/JakeWharton/NineOldAndroids
動畫兼容庫,用來在2.3及以下系統(tǒng)上使用屬性動畫,現(xiàn)已廢棄。
側滑菜單(類SlidingMenu)
DrawerLayout
官方的側滑菜單,功能強大。
https://github.com/jfeinstein10/SlidingMenu
老牌的側滑菜單。
https://github.com/daimajia/AndroidSwipeLayout
一般用來實現(xiàn)View內部的側滑。
輔助類庫
ItemTouchHelper
用來實現(xiàn)RecyclerView側滑刪除、拖拽排序的工具類。
https://github.com/rubensousa/RecyclerViewSnap
讓RecyclerView具備類似ViewPager的效果。
ViewDragHelper
處理View拖拽的神器,使用參考Android ViewDragHelper完全解析 自定義ViewGroup神器。
Scroller
用于實現(xiàn)View的平滑滾動,使用參考Android Scroller完全解析,關于Scroller你所需知道的一切。