解决方法:让button失去焦点,设置android:focusable="false",在item xml文件的根布局设置android:descendantFocusability="blocksDescendants"
代码:listview.xml
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent" android:layout_height="fill_parent"android:background="@color/white"><include layout="@layout/main_title" android:id="@+id/main_title_id" /><ListView android:layout_width="fill_parent" android:layout_height="fill_parent"android:divider="@null" android:listSelector="@android:color/transparent"android:dividerHeight="10dip" android:layout_below="@id/main_title_id" android:id="@+id/ye_listview_id" /><include android:layout_centerHorizontal="true"android:layout_centerInParent="true" android:layout_width="wrap_content"android:visibility="gone" android:layout_height="90dip" layout="@layout/progressbar" /></RelativeLayout>


item.xml布局文件:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent" android:layout_height="wrap_content"android:orientation="horizontal" android:descendantFocusability="blocksDescendants"  ><RelativeLayout android:layout_width="fill_parent"android:background="@drawable/ye_list_bg_selector"android:layout_height="wrap_content" android:gravity="center_vertical"><RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/relat_img_id"android:gravity="center_vertical"><ImageView android:id="@+id/ye_item_img"android:layout_height="60dip" android:layout_width="97dip"android:layout_marginLeft="10dip"/><Button android:id="@+id/list_price_id" android:layout_width="55.55dip"android:layout_height="16dip" android:background="@drawable/list_price_bg"android:layout_alignBottom="@id/ye_item_img" android:textSize="13sp"android:textColor="@color/white"  android:focusable="false"android:layout_alignRight="@id/ye_item_img" android:gravity="right|top" /></RelativeLayout><RelativeLayout android:layout_width="wrap_content"android:layout_height="wrap_content" android:layout_marginLeft="10dip"android:layout_toRightOf="@id/relat_img_id"><TextView android:id="@+id/ye_item_text1_id"android:layout_gravity="center_vertical" android:singleLine="true"android:layout_width="wrap_content" android:layout_height="wrap_content"android:text="XXXXX" android:textColor="@color/black"android:textSize="16sp" /><TextView android:id="@+id/ye_item_text2_id"android:layout_width="wrap_content" android:layout_height="wrap_content"android:ellipsize="end" android:maxLines="2" android:textColor="@color/gray"android:textSize="13sp" android:text="XXXXX" android:layout_below="@id/ye_item_text1_id" /><TextView android:id="@+id/ye_item_text3_id" android:textSize="13sp"android:layout_width="wrap_content" android:layout_height="wrap_content"android:text="XXXXX" android:layout_below="@id/ye_item_text2_id" /></RelativeLayout></RelativeLayout></LinearLayout>

更多相关文章

  1. NPM 和webpack 的基础使用
  2. 【阿里云镜像】使用阿里巴巴DNS镜像源——DNS配置教程
  3. Android(安卓)TextView 组件
  4. Android(安卓)layout xml总结
  5. android 随手记之文件+参数上传请求
  6. 关于android原生Webview的一些属性整理(持续补充~)
  7. Linux/Ubuntu下android设备添加adb驱动
  8. android APK签名过程之CERT.SF分析
  9. 恢复工厂设置流程

随机推荐

  1. Android(安卓)FrameWork 底层开发
  2. Android中串口通讯的问题
  3. 在网址中跳转APP(进入XXXAPP内查看)
  4. Android动画TimeInterpolator(插值器)和Typ
  5. Android常见面试题
  6. Android(安卓)Input子系统-含实例源码
  7. Android面试系列文章2018之Android部分之
  8. android快速上手(一)java基本知识学习
  9. Android(安卓)GridLayout网格布局、Radio
  10. Android(安卓)EditText属性介绍及监听内