android:duplicateParentState属性解释
android:duplicateParentState指的是当前控件是否跟随父控件的(点击、焦点等)状态
例:假设一Layout有两子View,对Layout进行监听点击事件;子ViewA一个设置duplicateParentState为true,子 View设置为false,当点击Layout后,子ViewA的点击态背景变色成功,子ViewB背景态变色无效,因为点击事件被Layout捕获。效 果如下图:

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="44dp"
android:id="@+id/finger_memo"
android:background="@drawable/setting_bottom" >
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="44dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:duplicateParentState="false"
android:gravity="top"
android:id="@+id/txt_memo"
android:paddingTop="10.5dp"
android:paddingBottom="10.5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txt_finger_memo"
android:layout_alignParentTop="true"
android:includeFontPadding="false"
android:text="@string/info_troopintro"
android:layout_marginLeft="12dp"
android:minWidth="74dp"
android:textColor="@color/color_777777_white"
android:duplicateParentState="false"
android:textSize="15sp" />
</RelativeLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/open_arrow"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_marginRight="12dp"
android:src="@drawable/arrow_right_gray_white" />
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/open_arrow"
android:layout_toRightOf="@id/txt_memo"
android:duplicateParentState="true"
android:paddingTop="10.5dp"
android:paddingLeft="10.5dp"
android:paddingBottom="10.5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txt_finger_memo_content"
android:layout_gravity="center_vertical|left"
android:includeFontPadding="false"
android:textColor="@color/color_333333_white"
android:text="@string/content"
android:duplicateParentState="true"
android:textSize="15sp"/>
</RelativeLayout>
</RelativeLayout>
<p style="margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px;">)xml中与像素有关的单位</p><div><ol style="margin: 5px 0px 5px 40px; padding: 0px;"><li>px(像素):屏幕上的点。 </li><li>in(英寸):长度单位。 </li><li>mm(毫米):长度单位。 </li><li>pt(磅):/72英寸。 </li><li>dp(与密度无关的像素):一种基于屏幕密度的抽象单位。在每英寸160点的显示器上,1dp = 1px。 在大于160点的显示器上可能增大。 </li><li>dip:与dp相同,多用于Google示例中。 </li><li>sp(与刻度无关的像素):与dp类似,但是可以根据用户的字体大小首选项进行缩放。 </li></ol></div><wbr>
)是否复制它的父布局的状态<p style="margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px;">在xml文件中添加如下属性:
android:duplicateParentState="true"</p><p style="margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-bottom: 0px;">当这个属性设置为"true"时,这个控件将优先从它的直接父控件获得当前的图片状态(例如,focused, pressed等等)。
对应java代码中的方法:
isDuplicateParentStateEnabled()</p>
</wbr>
android:duplicateParentState属性解释的更多相关文章
- android:duplicateParentState属性使用场景
对于这个属性的使用也是在偶然的时候发现的,之前从未使用它,所以有必要阐述一下它的用法,什么场景会要用它这个属性,在我不知道之前这个属性之前,也同样能实现效果,但是当我知道它的存在之后,我肯定在某种场景 ...
- <Android>从窗口泄漏谈android:configChanges属性
今天有幸去哥们的大公司做了半天的暂时工,一个偶现的Bug折腾了他好久,好不easy今天抓到了异常Log日志.大致的意思就是android.view.windowleaked--窗口泄漏.我在网上查了资 ...
- 【Android开发经验】android:windowSoftInputMode属性具体解释
本文章来自CSDN博客:http://blog.csdn.net/zhaokaiqiang1992.转载请注明地址! 在前面的一篇文章中,简单的介绍了一下怎样实现软键盘不自己主动弹出,使用的方法是设置 ...
- android动画具体解释二 属性动画原理
property动画是一个强大的框架,它差点儿能使你动画不论什么东西. 你能够定义一个动画来改变对象的不论什么属性,不论其是否被绘制于屏幕之上. 一个属性动画在一定时间内多次改变一个属性(对象的一个字 ...
- Android 组件属性
属性名称 描述 android:background 设置背景色/背景图片.可以通过以下两种方法设置背景为透明:”@android:color/transparent”和”@null”.注意TextV ...
- view组件的duplicateParentState属性
今天做页面的时候遇到一个小问题,在点击的时候改变组件的图片来源,这个很简单大家都知道,用selector可以很快实现.但是现状有点特殊,是 LinearLayout 中包裹着一个 ImageView ...
- Android layout属性大全
第一类:属性值 true或者 false android:layout_centerHrizontal 水平居中 android:layout_centerVertical 垂直居中 ...
- 【转】android布局属性详解
LinearLayout布局: 线性版面配置,在这个标签中,所有元件都是按由上到下的排队排成的.在这个界面中,我们应用了一个 LinearLayout的布局,它是垂直向下扩展的 ,所以创建的布局XML ...
- Android slidingmenu详细解释 滑动的优化
Android slidingmenu 详细解释 性能优化 转载请注明: http://blog.csdn.net/aaawqqq 简单介绍 SlidingMenu 是github 上Androi ...
随机推荐
- [教程]隐藏ActionBar中的MenuItem
有时候我们需要在不同的时候改变ActionBar中MenuItem的项数,或者隐藏某些MenuItem,百度上找了很久没什好资料,还是Google了一下,StackOverFlow上有大神解决了. 先 ...
- SQL 使用经验
1. 写存储过程,Update数据库表,一定要根据idRow,也就是主键唯一键来更新. 更新操作,如果根据其他条件更新,之后就有的忙活了. 2. Query语句要加NOLOCK
- qt动态更新界面的菜鸟代码,请指出
qt简单界面更新代码(菜鸟级)(部分代码) self.timers_1=QtCore.QTimer(self) self.timers_1.timeout.connect(self.min_1) se ...
- class 类(3) 继承
继承(Inheritance)是面向对象软 件技术当中的一个概念.如果一个类别A“继承自”另一个类别B,就把这个A称为“B的子类别”,而把B称为“A的父类别”,也可以称“B是A的超类”. 继承可以使得 ...
- android_launcher的源码详细分析
转载请注明出处:http://blog.csdn.net/fzh0803/archive/2011/03/26/6279995.aspx 去年做了launcher相关的工作,看了很长时间.很多人都在修 ...
- ASE中的主要数据库
Adaptive Server包括多种类型数据库: 必需数据库. “附加功能”数据库 .例子数据库 .应用数据库 1.必需数据库 master 数据库包含系统表,这些系统表中存储的数据被用来管理,有 ...
- Material Design说明
原文链接: Material Design 引言 我们挑战自我,为用户创造了一种视觉语言,综合了好设计的经典原则,革新以及科技的可能性.这就是material design.这份说明是一个动态的文档, ...
- jwplayer修改logo右键版权
jwplayer二次编译,可以自定义自己的logo和右键版权.
- MySql函数应用
-- 当前时间 now(); -- 查询结果串联(逗号) select group_concat(col_name) from table_name;
- java 中解析xml的技术
最初,XML 语言仅仅是意图用来作为 HTML 语言的替代品而出现的,但是随着该语言的不断发展和完善,人们越来越发现它所具有的优点:例如标记语言可扩展,严格的语法规定,可使用有意义的标记,内容存储和表 ...