简体   繁体   中英

How to show Toast when I click on the LayoutParams TextView

This is single TextView which is containing values form database. So I want when I click on the TextView, it should show Toast the same text in the position I clicked.

The image showing the text view

This is the code the TextView showing the data which is coming from the 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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