listview里子项有按钮的情况使用介绍_安卓软件开发教程-查字典教程网
listview里子项有按钮的情况使用介绍
listview里子项有按钮的情况使用介绍
发布时间:2016-12-28 来源:查字典编辑
摘要:你自定义按钮:复制代码代码如下: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"

/>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新安卓软件开发学习
    热门安卓软件开发学习
    编程开发子分类