Android的3D標簽云:TagCloudView

WillianRenn 8年前發布 | 25K 次閱讀 Android開發 移動開發

TagCloudView是一個完全基于Android ViewGroup編寫的控件,支持將一組View展示為一個3D標簽云,并支持全方向滾動。

使用說明:

Eclipse

copy代碼,或轉向Android Studio

Android Studio / IDEA

在build.gradle中添加

compile 'com.moxun:tagcloudlib:1.0.3'

在布局文件中引入

<com.moxun.tagcloudlib.view.TagCloudView/>

設置Adapter 繼承TagsAdapter,實現以下方法

public int getCount();
返回Tag數量
public View getView(Context context, int position, ViewGroup parent);
返回每個Tag實例
public Object getItem(int position);
返回Tag數據
public int getPopularity(int position);
針對每個Tag返回一個權重值,該值與ThemeColor和Tag初始大小有關
public void onThemeColorChanged(View view,int themeColor);
Tag主題色發生變化時會回調該方法

定制屬性

屬性 xml 代碼 值類型
自動滾動 app:autoScrollMode setAutoScrollMode(int mode) enum [disable,uniform,decelerate]
半徑百分比 app:radiusPercent setRadiusPercent(float percent) float [0,1]
滾動速度 app:scrollSpeed setScrollSpeed(float scrollSpeed) float [0,+]
起始顏色 app:lightColor setLightColor(int color) int
終止顏色 app:darkColor setDarkColor(int color) int



項目地址: https://github.com/misakuo/3dTagCloudAndroid

 本文由用戶 WillianRenn 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!