<RelativeLayout
android:id="@+id/linerlayout"
android:layout_width="match_parent"
android:layout_height="30px">
<CheckBox
android:id="@+id/check"
android:layout_width="30px"
android:layout_height="30px"
android:background="@mipmap/hot"
android:button="@null"
android:checked="false"
/>
<TextView
android:id="@+id/show"
android:layout_width="wrap_content"
android:layout_height="30px"
android:layout_gravity="center_vertical"
android:layout_marginLeft="12px"
android:layout_toRightOf="@id/check"
android:textColor="#666666"
android:textSize="22px" />
</RelativeLayout>
如上:在一个RelativeLayout 中 有一个checkbox 和textview控件,当想要点击Relativelayout选中checkbox时,出现了当点击checkbox时 RelativeLayout失去焦点:
此时只需要在checkbox控件标签内定义:
android:clickable="false"
android:enabled="false"
android:focusableInTouchMode="false"
android:focusable="false"
此时RelativeLayout不会失去焦点
转载请注明原文地址: https://www.6miu.com/read-42062.html