Skip to content

Item Click Issue #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 1, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Grid View Item Click Issue
  • Loading branch information
yogeshmadaan100 committed Apr 1, 2015
commit 0f52886baf620ae325b4fa7362783b661ad2e02d
4 changes: 4 additions & 0 deletions AndroidCustomGridView/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.source=1.6
2 changes: 1 addition & 1 deletion AndroidCustomGridView/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-14
target=android-21
2 changes: 1 addition & 1 deletion AndroidCustomGridView/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
android:numColumns="auto_fit"
android:verticalSpacing="5dp"
android:drawSelectorOnTop="true"
android:stretchMode="columnWidth" >
android:stretchMode="columnWidth">
</GridView>

</RelativeLayout>
11 changes: 7 additions & 4 deletions AndroidCustomGridView/res/layout/row_grid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
android:layout_marginTop="5dp"
android:orientation="vertical"
android:padding="5dp"
android:clickable="true"
android:clickable="false"
android:background="@drawable/grid_color_selector"
android:focusable="true">
android:focusable="false"
>

<ImageView
android:id="@+id/image"
android:layout_width="100dp"
android:layout_height="100dp" >
android:layout_height="100dp"
>
</ImageView>

<TextView
Expand All @@ -21,7 +23,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:textSize="12sp" >
android:textSize="12sp"
>
</TextView>

</LinearLayout>
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package com.javatechig.gridview;

import java.util.ArrayList;
import android.os.Bundle;

import android.app.Activity;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.Toast;



/**
*
* @author javatechig {@link http://javatechig.com}
Expand All @@ -33,6 +37,7 @@ protected void onCreate(Bundle savedInstanceState) {
gridView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
Log.e("item", "clicked");
Toast.makeText(MainActivity.this, position + "#Selected",
Toast.LENGTH_SHORT).show();
}
Expand Down