亲宝软件园·资讯

展开

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

人气:0
想了解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"
/>

加载全部内容

相关教程
猜你喜欢
用户评论