标签在一个按钮

时间:2017-10-31 14:05:28

标签: android button

如何在按钮中添加标签,如图像中所示? inserir a descrição da imagem aqui

单击此按钮时,标签消失,只是为了在此菜单中显示新内容。 我无法想到这一切。

2 个答案:

答案 0 :(得分:1)

你可以找到一些我认为最好被称为'Feature Highliter'的东西

这个图书馆TapTargetView正在这样做。

enter image description here

答案 1 :(得分:1)

您可以在需要时以编程方式创建ImageView。

ImageView financasLabel = new ImageView(context); 

如果您计划将视图添加到RelativeLayout,则必须使用RelayiveLayout.LayoutParams。因此,你必须从xml中做同样的事情:添加布局规则。请参阅文档......总体如下:

RelayiveLayout.LayoutParams params = new 
RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, 
LayoutParams.MATCH_PARENT);

 // TODO set the params
 params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
 ...

financasLabel .setLayoutParams(params);
relativeLayout.addView(financasLabel );

要隐藏imageView,请使用:

imageView.setVisibility(View.GONE) ;) //Espero ter ajudado marcelo ;)
相关问题