2013-03-05 54 views
0

我想在我的網格視圖項目中顯示編輯文本。問題是,在這種情況下,GridView控件不處理itemClick事件(因爲它是寫hereGridView中的EditText

我的GridView的項目是這樣的:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/main_resume_item_layout" 
      android:layout_height="160dip" 
      android:layout_width="150dip"> 

<ImageView 
    android:id="@+id/item_icon" 
    android:layout_height="120dip" 
    android:layout_width="fill_parent" 
    android:src="@drawable/icon" 
    android:layout_gravity="center"/> 

<LinearLayout 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent" 
    android:layout_marginTop="70dip" 
    android:orientation="vertical" 
    android:paddingLeft="30dip" 
    android:background="#FF5" 
    android:paddingRight="10dip"> 

    <TextView 
     android:id="@+id/created" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Created" 
     android:gravity="center" 
     android:textColor="#000"/> 

    <TextView 
     android:id="@+id/resume_date" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="18.01.2013" 
     android:gravity="center" 
     android:textColor="#000"/> 

    <ProgressBar 
     android:id="@+id/resume_progress" 
     android:layout_width="fill_parent" 
     android:layout_height="6dip" 
     style="@android:style/Widget.ProgressBar.Horizontal" 
     android:max="70" 
     android:progress="50" 
     android:background="@drawable/progress" 
     android:progressDrawable="@drawable/progress"/> 

</LinearLayout> 

<TextView 
    android:id="@+id/resume_title" 
    android:layout_below="@id/item_icon" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Example resume" 
    android:textColor="#5544FF" 
    android:textStyle="bold" 
    android:textSize="18sp" 
    android:gravity="center"/> 

<EditText 
    android:id="@+id/resume_title_edit" 
    android:layout_below="@id/item_icon" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Example resume" 
    android:textColor="#5544FF" 
    android:textStyle="bold" 
    android:textSize="18sp" 
    android:gravity="center" 
    android:inputType="text" 
    android:visibility="invisible"/> 

我不知道有什麼辦法在GridView中有EditText並處理ItemClick事件?也許有人知道一些解決方法來做到這一點?

回答

1
android:focusableInTouchMode="false" 
android:focusable="false" 

將此項添加到您layout中除edittext之外的所有其他視圖。

OR, 您可以在適配器類中添加單擊事件。

+0

我已經添加了這個,但它沒有幫助。用於GridView的OnItemClickListener仍然不起作用 – Bersh 2013-03-05 12:41:05

+0

謝謝,我想我通過在我的適配器中添加單擊事件佈局來解決此問題 – Bersh 2013-03-05 14:07:25