2按钮ListView中的机器人 [英] 2 Buttons in ListView in android

查看:109
本文介绍了2按钮ListView中的机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义的ListView,其中有2个按钮,每行一个TextView。

我想改变点击的按钮的文本。如何确定哪个按钮,其中行被点击,再怎么改同一按钮上的文字。

其紧迫,请帮助.. !!

在此先感谢。

解决方案

 如何确定哪个按钮,其中行已被点击
 

使用onClickListener()。当单击一个按钮,按钮的onClickListener将被调用。

 如何改变同一个按钮的文本
 

在onClickListener(),你可以这样做

  yourTextView.setTextColor(Color.rgb(0,0,0)); //与颜色的RGB值替换0,0,0
 

I have a custom ListView in which there are 2 buttons and a textview in each row.

I want to change the text of the clicked button. How to identify that which button of which row has been clicked and then how to change the text of the same button.

Its urgent, kindly help..!!

Thanks in advance.

解决方案

How to identify that which button of which row has been clicked

Use onClickListener(). When a button is clicked that button's onClickListener will be called.

How to change the text of the same button

In onClickListener() you can do something like

yourTextView.setTextColor(Color.rgb(0,0,0)); //replace 0,0,0 with the rgb value of the color

这篇关于2按钮ListView中的机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆