Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

您好,我有一个新需求 #35

Open
ThisisUserNmae opened this issue Oct 21, 2019 · 1 comment
Open

您好,我有一个新需求 #35

ThisisUserNmae opened this issue Oct 21, 2019 · 1 comment

Comments

@ThisisUserNmae
Copy link

您好,我是LabelsView控件的使用者,,感谢您的开源,我有一个需求,是这样的
LabelsView的每一个子条目标签的颜色都不一样
比如第一个标签颜色为红 第二个为黑 第三个为绿,我自己定义了一个数组存放,这样颜色值,通过随机数的方式来设置,这些颜色值,但是LabelsView 目前好像只支持LabelsView 整体标签的颜色是吗? 如果不是 如何设置呢?

@donkingliang
Copy link
Owner

LabelsView提供的方法都是对标签列表的整体设置。不过可以在LabelTextProvider中对标签项进行单独设置的,可以在这里单独设置标签的颜色。
labelsView.setLabels(testList, new LabelsView.LabelTextProvider() {
@OverRide
public CharSequence getLabelText(TextView label, int position, TestBean data) {

	// label就是标签项,在这里可以对标签项单独设置一些属性,比如文本样式等。

	//根据data和position返回label需要显示的数据。
    return data.getName();
}

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants