2014-08-29 1 views
0

회 전자 옵션의 전체 행을 클릭 할 수있게하고 싶습니다. 나는 googleing하고 다른 옵션을 시도하지만 TextView 만 클릭 할 수 있습니다.회 전자 드롭 다운 옵션의 전체 행을 클릭하는 방법

enter image description here

스피너 항목 XML :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:descendantFocusability="blocksDescendants" 
    android:orientation="vertical" > 

    <TextView 
     android:id="@+id/tvSpinerItemDescription" 
     android:layout_width="fill_parent" 
     android:layout_height="48dp" 
     android:clickable="false" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:fontFamily="sans-serif-light" 
     android:gravity="center" 
     android:paddingLeft="10dp" 
     android:textColor="@color/dark_gray_4" 
     android:textSize="16sp" /> 

    <TextView 
     android:id="@+id/tvSpinerItemID" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:clickable="false" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:visibility="gone" /> 

</LinearLayout> 

답변

0

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:descendantFocusability="blocksDescendants" 
android:orientation="vertical" > 

<TextView 
    android:id="@+id/tvSpinerItemDescription" 
    android:layout_width="match_parent" 
    android:layout_height="48dp" 
    android:clickable="false" 
    android:focusable="false" 
    android:focusableInTouchMode="false" 
    android:fontFamily="sans-serif-light" 
    android:gravity="center" 
    android:paddingLeft="10dp" 
    android:textColor="@color/dark_gray_4" 
    android:textSize="16sp" /> 

<TextView 
    android:id="@+id/tvSpinerItemID" 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:clickable="false" 
    android:focusable="false" 
    android:focusableInTouchMode="false" 
    android:visibility="gone" /> 

시도
0
<Spinner 
android:id="@+id/my_spinner" 
... 
android:spinnerMode="dropdown"/> 



ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); 
    dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 
    spinner.setAdapter(dataAdapter); 
관련 문제