GridView에서 OnItemClick 이벤트를 캡처 할 수 없기 때문에 문제가 있습니다 (항목에 TextView 및 WebView가 있음). 활동에Android OnItemClick 이벤트가 GridView의 WebView 및 텍스트에서 작동하지 않습니다.
list_item_layout_redes.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/estilocasilla" >
<com.mhp.desarrollo.laycosandroid.CuadroImagenRed ======THIS IS A CLASS THAT EXTENDS WEBVIEW
android:id="@+id/imagen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:scrollbars="none" />
<TextView
android:id="@+id/texto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#55000000"
android:paddingBottom="15dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:textColor="@android:color/white"
android:textStyle="bold"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"/>
activity_redes.xml
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" >
.....
<GridView
android:id="@+id/gvRedes1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/grisMedio"
android:cacheColorHint="#00000000"
android:numColumns="2"
android:textAlignment="textStart" >
</GridView>
...
</FrameLayout>
코드의이 부분 : 나는 제대로의 GridView에서 데이터를로드하지만 여기에 작동하지 않습니다 onItemClick 내 코드입니다 onItemClick 부분이 있습니다
if (gvRedes1 != null) {
gvRedes1.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> a, View v, int position,
long id)
누구를 도와 드릴까요? 나는 해결책을 찾지 못한다.
안부 {에서
아마 때문에 당신은 WebView로 전체 항목을 다루고 있습니다. getView() 메서드의 각 항목 대신 전체보기에서 OnClickListener를 설정해보십시오. – Carnal
감사 Carnal, 이제 GridView 항목이 선택되어 있지만 onItemClick도 여전히 작동하지 않는 것을 볼 수 있습니다. 도와 드릴까요? 감사합니다 – user2316075
각 비정상 항목에 대한 getView() 메소드의 각 "보기"에 OnClick이 아닌 OnClick을 설정할 수 있습니다. 그런 다음 onClick 내부에서 onItemClick에서 일반적으로 수행 할 작업을 수행 할 수 있습니다. getView()에서 어떤 항목을 클릭했는지 알고 있기 때문에! – Carnal