• Stars
    star
    870
  • Rank 52,440 (Top 2 %)
  • Language
    Java
  • Created over 9 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

支持 SingleLine 模式的标签云效果

TagCloudView TagCloudView

支持 SingleLine 模式的标签云效果,轻松实现知乎问题话题列表
标签云效果,可以设置为 SingleLine 模式,丰富的自定义样式选择。
只需要一行代码即可设置 SingleLine 模式:app:tcvSingleLine="true" true 为 SingleLine 模式,false 为默认标签云模式
###Demo apk 下载: ListView 效果
扫码或点我下载

Update 更新

  • 版本号1.0.2:fix #4 添加切换单行多行方法 TagCloudView.singleLine(true)

How to use 如何使用

Gradle

使用 JCenter 在项目的 build.gradle 中添加如下代码

  compile 'com.github.kingideayou:tagcloudview:1.0.2'

Import

首先下载 tagView,将 tagView 文件夹拷贝到项目的目录下面,然后在setting.gradle文件中增加文件夹名称

  include ":tagview"

然后在我们需要依赖这个模块的module中的build.gradle文件中加入如下代码:

  compile project(':tagview')

导入成功后,只需要在 XML 文件中添加如下视图

  <me.next.tagview.TagCloudView
        android:id="@+id/tag_cloud_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/background_tagcloudview_black_selector"
        app:tcvItemBorderHorizontal="8dp"
        app:tcvItemBorderVertical="6dp"
        app:tcvBorder="8dp"
        app:tcvTextColor="#123455"
        app:tcvSingleLine="true"
        app:tcvCanTagClick="true"
        />

在 Activity 中调用如下方法即可

  List<String> tags = new ArrayList<>();
    for (int i = 0; i < 20; i++) {
        tags.add("标签" + i);
    }
    
  TagCloudView tagCloudView1 = (TagCloudView) findViewById(R.id.tag_cloud_view_1);
  tagCloudView1.setTags(tags);
  tagCloudView1.setOnTagClickListener(this);
  tagCloudView1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Toast.makeText(getApplicationContext(), "TagView onClick",
                    Toast.LENGTH_SHORT).show();
        }
    });
    
   @Override
  public void onTagClick(int position) {
    if (position == -1) {
        Toast.makeText(getApplicationContext(), "点击末尾文字",
                Toast.LENGTH_SHORT).show();
    } else {
        Toast.makeText(getApplicationContext(), "点击 position : " + position,
                Toast.LENGTH_SHORT).show();
    }
  }

效果图

TagCloudView

TagCloudView

动图展示:

TagCloudView

License

Copyright 2015 NeXT

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

SlideBottomPanel

底部划动菜单,滑动时背景图透明度渐变,支持嵌套 ListView 或 ScrollView
Java
811
star
2

UCE-Handler

调试时捕获程序崩溃,可提供崩溃的类名、方法名、行数、Error Log、Activity 路径、设备信息、应用信息...
Java
53
star
3

PagerSlidingTabStripPro

A powerful library from PageSlidingTabStrip
Java
27
star
4

RadarView

A custom view looks like a searching radar.
Java
23
star
5

MarkwonCodeEx

Markwon extensition support elegant code background. 为 Markwon 提供优雅的代码块显示
Kotlin
22
star
6

Android_M_Permission

android m permission demo
Java
9
star
7

CaptureView

屏幕选区视图
Java
7
star
8

ClipboardLinkDetect

获取剪贴板 url 并通过 url 获取网页标题
Java
5
star
9

EditTextPlus

Java
5
star
10

ScreenShotDemo

Android Screenshot without StatusBar Demo.
Java
5
star
11

NinePicView

支持自定义单图尺寸,「长图」、「Gif」 标记的九宫格视图
Java
4
star
12

ParabolaEmojiRain

Java
4
star
13

ZXingPro

识别图片二维码&生成二维码图片。Decode barcode image & Generate barcode image.
Java
3
star
14

Juejin-Alfred-Workflow

An Alfred Workflow for juejin.im
Python
3
star
15

AndroidSDKSearchAlfred

A Alfred extension that adds an 'asdk' command and view source links for the Android SDK.
Python
3
star
16

FeidianElectron

掘金沸点 Mac、Windows 客户端(非官方)
JavaScript
3
star
17

ShareBottomSheet

Java
2
star
18

bilibilitvapk

1
star
19

RainbowRecyclerView

Java
1
star
20

GoldDemoProject

Java
1
star
21

LinkageViewPager

A linkage ViewPager.(联动的 ViewPager)
Java
1
star
22

ViewPagerNested

Java
1
star
23

NestedScrollViewDemo

Java
1
star
24

AddToCart

a animation for "add to cart"
Java
1
star
25

kingideayou.github.io

博客
HTML
1
star
26

WebViewLongScreenShot

Java
1
star
27

LeanCloudJSDemo

HTML
1
star
28

EmoticonKeyboard

Java
1
star