}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:id="@+id/listView" android:layout_width="wrap_content" android:layout_height="fill_parent" android:padding="@dimen/padding_medium" tools:context=".Audition1" android:dividerHeight="5dp"/></RelativeLayout>
LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "fill_parent" android:layout_height= "match_parent" android:orientation= "horizontal" > <TextView android:id= "@+id/textViewId" android:layout_width= "wrap_content" android:layout_height= "wrap_content" android:text= "@string/hello_world" /> <ImageView android:id= "@+id/imageView" android:layout_width= "wrap_content" android:layout_height= "wrap_content" android:src= "@drawable/ic_launcher" android:contentDescription= "@string/app_name" /> <Button android:id= "@+id/button" android:layout_width= "wrap_content" android:layout_height= "wrap_content" android:text= "press" android:focusable= "false" /> </LinearLayout> |
原因是button强制获取了item的焦点,只要设置button的focusable为false即可。
新闻热点
疑难解答