ListView之Item click事件与Item中的控件点击事件共存

来源:互联网 发布:身高测试软件 编辑:程序博客网 时间:2024/05/17 14:28
<pre name="code" class="html"><pre name="code" class="html"> 1、android:descendantFocusability="blocksDescendants"
2、android:focusable="false"
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="100dp"    android:background="@color/whiteColor"    android:descendantFocusability="blocksDescendants"    android:paddingBottom="@dimen/dimen6"    android:paddingTop="@dimen/dimen6" >    <CheckBox        android:id="@+id/cart_check"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_centerVertical="true"        android:layout_marginLeft="@dimen/dimen6"        android:paddingRight="@dimen/dimen6"        android:focusable="false"        android:button="@drawable/button_selector"        android:gravity="center" />    <ImageView        android:id="@+id/cart_image"        android:layout_width="100dp"        android:layout_height="70dp"        android:layout_centerVertical="true"        android:layout_toRightOf="@id/cart_check"        android:scaleType="fitXY"        android:src="@drawable/ic_launcher" />    <RelativeLayout        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_toRightOf="@id/cart_image" >        <RelativeLayout            android:id="@+id/rl_cartlist_item_info"            android:layout_width="match_parent"            android:layout_height="match_parent"            android:background="@color/whiteColor"            android:visibility="visible" >            <com.lecake.android.ui.MyCustomTextView                android:id="@+id/cart_edit"                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:layout_alignParentRight="true"                android:layout_centerVertical="true"                android:layout_marginRight="5dp"                android:background="@drawable/gray_bt_stroke_shape"                android:gravity="center"                android:paddingBottom="@dimen/dimen4"                android:paddingLeft="@dimen/dimen6"                android:paddingRight="@dimen/dimen6"                android:paddingTop="@dimen/dimen4"                android:text="编辑"                android:textSize="14sp" />            <LinearLayout                android:layout_width="match_parent"                android:layout_height="match_parent"                android:layout_marginLeft="10dp"                android:layout_marginRight="10dp"                android:layout_toLeftOf="@id/cart_edit"                android:orientation="vertical" >                <com.lecake.android.ui.MyCustomTextView                    android:id="@+id/cart_name"                    android:layout_width="wrap_content"                    android:layout_height="0dp"                    android:layout_weight="1"                    android:paddingTop="2dp"                    android:singleLine="true"                    android:text="雪域牛栏芝士蛋糕" />                <com.lecake.android.ui.MyCustomTextView                    android:id="@+id/cart_englishname"                    android:layout_width="wrap_content"                    android:layout_height="0dp"                    android:layout_weight="1"                    android:ellipsize="end"                    android:maxEms="10"                    android:singleLine="true"                    android:text="Le Cheesecake" />                <com.lecake.android.ui.MyCustomTextView                    android:id="@+id/cart_spec"                    android:layout_width="wrap_content"                    android:layout_height="0dp"                    android:layout_weight="1"                    android:text="1磅    34*23cm" />                <LinearLayout                    style="@style/BaseLineHeight"                    android:layout_width="wrap_content"                    android:layout_height="0dp"                    android:layout_weight="1"                    android:orientation="horizontal" >                    <com.lecake.android.ui.MyCustomTextView                        android:layout_width="wrap_content"                        android:layout_height="wrap_content"                        android:singleLine="true"                        android:text="¥"                        android:textColor="@color/gray_light" />                    <com.lecake.android.ui.MyCustomTextView                        android:id="@+id/cart_price"                        android:layout_width="wrap_content"                        android:layout_height="wrap_content"                        android:singleLine="true"                        android:text="12  x1"                        android:textColor="@color/red" />                </LinearLayout>            </LinearLayout>        </RelativeLayout>        <LinearLayout            android:id="@+id/ll_cartlist_item_edit"            android:layout_width="match_parent"            android:layout_height="match_parent"            android:layout_centerVertical="true"            android:layout_marginLeft="10dp"            android:background="@color/whiteColor"            android:orientation="vertical"            android:visibility="gone" >            <LinearLayout                android:layout_width="match_parent"                android:layout_height="30dp"                android:gravity="center_vertical"                android:orientation="horizontal" >                <ImageView                    android:id="@+id/decEt"                    android:layout_width="wrap_content"                    android:layout_height="match_parent"                    android:layout_marginRight="@dimen/dimen6"                    android:src="@drawable/dec_press" />                <EditText                    android:id="@+id/numEt"                    android:layout_width="0dp"                    android:layout_height="match_parent"                    android:layout_weight="1"                    android:background="@drawable/cart_input_bg"                    android:ems="10"                    android:enabled="false"                    android:gravity="center"                    android:text="1" >                </EditText>                <ImageView                    android:id="@+id/addImg"                    android:layout_width="wrap_content"                    android:layout_height="match_parent"                    android:layout_marginLeft="@dimen/dimen6"                    android:layout_marginRight="@dimen/dimen20"                    android:src="@drawable/inc_press" />                <com.lecake.android.ui.MyCustomTextView                    android:id="@+id/tv_cartlist_item_save"                    android:layout_width="wrap_content"                    android:layout_height="wrap_content"                    android:layout_marginRight="5dp"                    android:background="@drawable/gray_bt_stroke_shape"                    android:gravity="center"                    android:paddingBottom="@dimen/dimen4"                    android:paddingLeft="@dimen/dimen6"                    android:paddingRight="@dimen/dimen6"                    android:paddingTop="@dimen/dimen4"                    android:text="完成"                    android:textSize="14sp" />            </LinearLayout>            <LinearLayout                android:layout_width="match_parent"                android:layout_height="30dp"                android:layout_marginTop="@dimen/dimen6"                android:gravity="center_vertical"                android:orientation="horizontal" >                <GridView                    android:id="@+id/gridview"                    android:layout_width="0dp"                    android:layout_height="wrap_content"                    android:layout_marginRight="@dimen/dimen20"                    android:layout_weight="1"                    android:background="#FFFFFF"                    android:cacheColorHint="#00000000"                    android:gravity="left"                    android:listSelector="#00000000"                    android:numColumns="4"                    android:scrollbars="none" />                <com.lecake.android.ui.MyCustomTextView                    android:id="@+id/tv_cartlist_item_del"                    android:layout_width="wrap_content"                    android:layout_height="wrap_content"                    android:layout_marginRight="5dp"                    android:background="@drawable/gray_bt_stroke_shape"                    android:gravity="center"                    android:paddingBottom="@dimen/dimen4"                    android:paddingLeft="@dimen/dimen6"                    android:paddingRight="@dimen/dimen6"                    android:paddingTop="@dimen/dimen4"                    android:text="删除"                    android:textSize="14sp" />            </LinearLayout>        </LinearLayout>    </RelativeLayout></RelativeLayout>


                                             
0 0
原创粉丝点击