手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >listview里子项有按钮的情况使用介绍
listview里子项有按钮的情况使用介绍
摘要:你自定义按钮:复制代码代码如下:publicclassMyButtonextendsButton{publicDontPressWithPa...

你自定义按钮:

复制代码 代码如下:

public class MyButton extends Button {

public DontPressWithParentImageView(Context context, AttributeSet attrs) {

super(context, attrs);

}

@Override

public void setPressed(boolean pressed) {

// If the parent is pressed, do not set to pressed.

if (pressed && ((View) getParent()).isPressed()) {

return;

}

super.setPressed(pressed);

}

}

然后在布局人间中这样引用:

复制代码 代码如下:

<your.name.customview.MyButton

android:id="@+id/mybutton"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

/>

【listview里子项有按钮的情况使用介绍】相关文章:

Android控件系列之Toast使用介绍

android实现listview分页的方法

Android中BroadcastReceiver(异步接收广播Intent)的使用

基于Android AppWidgetProvider的使用介绍

android ListView和GridView拖拽移位实现代码

Android控件系列之CheckBox使用介绍

Android中没有插入SD情况下的文件写入和读取方法

android listview优化几种写法详细介绍

Android里实现退出主程序的提示代码

Android应用开发中模拟按下HOME键的效果(实现代码)

精品推荐
分类导航