事件分发,导致文字设置颜色(无效)记录
来源:互联网 发布:截面数据用什么模型 编辑:程序博客网 时间:2024/05/01 06:05
布局文件:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ll_mutil" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <LinearLayout android:layout_marginTop="15dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <!-- <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > --> <!-- android:drawableRight="@drawable/quesion_checkbox_selector" android:button="@null" --> <CheckBox android:layout_marginLeft="12dp" android:layout_marginRight="5dp" android:layout_marginTop="1dp" android:id="@+id/cb_qustion_body" android:layout_width="match_parent" android:layout_height="wrap_content" android:button="@null" android:checked="false" android:drawableRight="@drawable/quesion_checkbox_selector" android:textColor="#696969" android:textSize="14sp" /> <!-- </LinearLayout> --> <!-- <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > --> <LinearLayout android:id="@+id/ll_qustion_body_controlpic" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <ImageView android:layout_marginLeft="10dp" android:id="@+id/iv_qustion_body" android:layout_width="100dp" android:layout_height="100dp" android:scaleType="fitXY" android:src="@drawable/personal_head_icon" android:visibility="gone" /> <TextView android:id="@+id/tv_qustion_body" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:layout_marginTop="6dp" android:layout_marginLeft="10dp" android:text="上海" android:textColor="#696969" android:textSize="14dp" /> </LinearLayout> <!-- </LinearLayout> --> </LinearLayout><View android:layout_width="match_parent" android:layout_height="1dp" android:background="#EFEFEF" /></LinearLayout>
布局预览图:
代码控制(最外层线性布局点击事件):
ll_mutil.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) {// Toast.makeText(ctx, "多选,选中", 0).show(); mutil_click(MutilTpleQuestOption, cb_qustion_body, ll_mutil);// if (QuestionDetailActivity.submitMap.containsKey(tpleQuestSubject.getSubjectId())) {// if (!positions.contains(position)) { positions.add(position);// }// } } });
出问题代码处:
LinearLayout ll_qustion_body_controlpic=(LinearLayout) view.findViewById(R.id.ll_qustion_body_controlpic); ImageView iv_qustion_body=(ImageView) view.findViewById(R.id.iv_qustion_body); TextView tv_qustion_body=(TextView) view.findViewById(R.id.tv_qustion_body); if (canQuest) { ll_qustion_body_controlpic.setEnabled(true); ll_mutil.setEnabled(true); cb_qustion_body.setEnabled(true); ll_qustion_body_controlpic.setClickable(true); ll_mutil.setClickable(true); cb_qustion_body.setClickable(true); }else{ ll_qustion_body_controlpic.setEnabled(false); ll_mutil.setEnabled(false); cb_qustion_body.setEnabled(false); ll_qustion_body_controlpic.setClickable(false); ll_mutil.setClickable(false); cb_qustion_body.setClickable(false); }
布局文件层次
下面代码 导致: ll_mutil.setOnClickListener 无法接收到事件的传递
ll_qustion_body_controlpic.setEnabled(true); ll_qustion_body_controlpic.setClickable(true);
ll_qustion_body_controlpic.setEnabled(false); ll_qustion_body_controlpic.setClickable(false);
0 0
- 事件分发,导致文字设置颜色(无效)记录
- viewGroup事件分发记录
- View事件分发记录
- TextView设置部分文字颜色和点击事件
- 设置标题栏文字颜色。
- 设置jlabel文字颜色
- CSS设置文字颜色
- 链接文字颜色设置
- android事件分发点滴记录
- 触摸事件分发文章记录
- android textview可以设置文字颜色 部分文字点击事件处理
- 关于TextView中,设置指定部分文字改变颜色,和指定部分文字点击事件
- Android 关于TextView中,设置指定部分文字改变颜色,和指定部分文字点击事件
- DataGridView标题栏颜色设置无效 ...
- DataGridView标题栏颜色设置无效 ...
- DataGridView标题栏颜色设置无效 ...
- DataGridView标题栏颜色设置无效
- 设置CButtonST按钮文字颜色
- 2016总结-2017计划
- 怎么连接数据库
- app依赖详解
- NFV与SDN的区别与联系
- gulp
- 事件分发,导致文字设置颜色(无效)记录
- Selenium/Java读取动态页面图片验证码,tesseract转换为文本
- Spring中依赖注入的几种方式
- 150. Evaluate Reverse Polish Notation
- Android NDK 开发 AndroidStudio 2.2 NDK的开发环境搭建
- 数字天堂HBuilder+MUI(三)Native.js指南
- MySQL数据库引擎详解
- dep加的字段在UI界面的处理
- 阿里巴巴集团成为国家信息安全漏洞库(CNNVD)技术支撑单位