简体   繁体   English

单击 LayoutParams TextView 时如何显示 Toast

[英]How to show Toast when I click on the LayoutParams TextView

This is single TextView which is containing values form database.这是单个TextView ,其中包含来自数据库的值。 So I want when I click on the TextView, it should show Toast the same text in the position I clicked.所以,我想,当我点击TextView,它应该显示Toast在我点击的位置相同的文字。

The image showing the text view显示文本视图的图像

This is the code the TextView showing the data which is coming from the firebase.这是TextView显示来自 Firebase 的数据的代码。

textView = new TextView(Chat.this);                                                                                                       
textView.setText(message);                                                                                                                  
final Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/fnt1.otf");                                                  

  textView.setTypeface(typeface);                                                                                                             
  LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  lp.setMargins(0, 0, 0, 20);
  textView.setLayoutParams(lp);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM