Android 微调器单击效果可以';不要将视图包括在内
我正在开发一个android应用程序 我使用自定义微调器进行选择 我面临一个问题,那就是当我按下微调器时,微调器内的自定义视图 似乎无法选择 我想效果可以包括所有的东西里面,而不仅仅是外面的微调器 像 xml:Android 微调器单击效果可以';不要将视图包括在内,android,android-layout,android-widget,Android,Android Layout,Android Widget,我正在开发一个android应用程序 我使用自定义微调器进行选择 我面临一个问题,那就是当我按下微调器时,微调器内的自定义视图 似乎无法选择 我想效果可以包括所有的东西里面,而不仅仅是外面的微调器 像 xml: <Spinner android:id="@+id/calendars_spinner" android:focusable="true" android:layout_width="0dip" android:la
<Spinner
android:id="@+id/calendars_spinner"
android:focusable="true"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="12dip"
android:layout_marginRight="12dip"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingBottom="10dip"
android:paddingTop="10dip"/>
内部视图(calendar\u spinner\u item.xml)
谢谢 而不是:
convertView.setBackgroundColor(group.getColor())代码>
添加到可选择的可绘制:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:backround="@drawable/some_selectable_drawable>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/calendar_name"
style="?android:attr/spinnerItemStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#FFFFFFFF"
android:textSize="18sp" />
<TextView
android:id="@+id/account_name"
style="?android:attr/spinnerItemStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/calendar_name"
android:layout_below="@id/calendar_name"
android:ellipsize="marquee"
android:singleLine="true"
android:textColor="#FFFFFFFF"
android:textSize="14sp" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:backround="@drawable/some_selectable_drawable>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/button_sel"
android:state_selected="true"
android:state_pressed="true"/>
<item android:drawable="@drawable/button_unsel"
android:state_selected="false"
android:state_pressed="false"/>
</selector>