listview中的按钮 listview里子项有按钮的情况使用介绍

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

listview中的按钮 listview里子项有按钮的情况使用介绍

  2021-03-18 我要评论
想了解listview里子项有按钮的情况使用介绍的相关内容吗,在本文为您仔细讲解listview中的按钮的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:listview,按钮,子项,下面大家一起来学习吧。
你自定义按钮
复制代码 代码如下:

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"
/>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们