如何实现View上添加标签

效果图:

利用 https://github.com/linger1216/labelview 类库来实现

具体代码 问度娘。

{
LabelView label = new LabelView(this);
label.setText("HD");
label.setBackgroundColor(0xffE91E63);
label.setTargetView(findViewById(R.id.button), 4, LabelView.Gravity.RIGHT_TOP);
findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "button click", Toast.LENGTH_SHORT).show();
}
});
}

希望通过看大牛的博客对你有较多的收获:

http://blog.csdn.net/nmsoftklb/article/details/46894577

同时 做出整理:详情剖析API Demos中的LabelView链接:

http://blog.csdn.net/manymore13/article/details/8769013

原文地址:https://www.cnblogs.com/yizuochengchi2012/p/4679064.html