{"id":83635,"date":"2021-08-16T09:00:14","date_gmt":"2021-08-16T03:30:14","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=83635"},"modified":"2024-08-05T11:12:24","modified_gmt":"2024-08-05T05:42:24","slug":"android-gridview","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/","title":{"rendered":"Android GridView with Implementation"},"content":{"rendered":"<p>Think about apps like Gallery \u2013 those grids of thumbnails showcasing your photos and videos. This is a prime example of GridView in action. GridView isn&#8217;t limited to just gallery apps; it&#8217;s a versatile tool that can enhance the visual presentation of various data items in a grid format, making it useful for a variety of applications.<\/p>\n<p>In this article, we\u2019ll explore the significance of GridView, how it can be utilized in different contexts, and provide a step-by-step guide to implementing it in Android Studio. Whether you&#8217;re looking to create a sleek photo gallery or organize other types of content, understanding GridView is a valuable skill for any Android developer.<\/p>\n<h3>What is an Android GridView?<\/h3>\n<p>Android GridView is a well-known way of representing data items. Whenever you require something like a table, then you can use GridView. GridView is a two-dimension view where you have both rows and columns to hold data items. Below is a pictorial representation of how a GridView looks.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/07\/Grid-View-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-83791\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/07\/Grid-View-1.jpg\" alt=\"Android Grid View\" width=\"311\" height=\"502\" \/><\/a><\/p>\n<p>GridView is auto-scrollable. You need not use any ScrollView or NestedScrollView to make the grid scrollable. Whenever there are more items in the grid, you can scroll the grid without using any other view.<\/p>\n<h3>How to create a GridView in Android<\/h3>\n<p>Creating a GridView involves two steps. Firstly, you need to design the GridView in the layout by using the &lt;GridView&gt; tags. Secondly, you need to insert data items into the grid. You need to use the Android Adapter. Android Adapter helps in getting the content from the data source and then dump into the GridView.<\/p>\n<p>Below is an example of how you can create a GridView in Android.<\/p>\n<p><strong>XML Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;GridView\r\n        android:background=\"@color\/white\"\r\n        android:id=\"@+id\/food_grid_view\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"match_parent\"\r\n        android:numColumns=\"2\"\r\n        android:horizontalSpacing=\"10dp\"\r\n        android:verticalSpacing=\"10dp\"\r\n        android:layout_margin=\"10dp\"\/&gt;\r\n<\/pre>\n<p><strong>Kotlin Code to attach the adapter:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">\/\/creating the object of the Adapter and passing data and context\r\n val foodAdapter = FoodAdapter(this@MainActivity, foodImages)\r\n\r\n \/\/setting the adapter to our GridView\r\n foodGridView.adapter = foodAdapter\r\n<\/pre>\n<h3>Attributes in Android GridView<\/h3>\n<p>The attributes present in the GridView are set properties that are applied to a GridView to style it and add more functionalities to it. Some of the prevalent attributes in GridView are mentioned below.<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Attribute Name<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">android:id<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The \u201cid\u201d attribute of the GridView is used to identify the view in a pool of many views uniquely.\u00a0<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">android:horizontalSpacing<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The \u201chorizontalSpacing\u201d attribute of GridView is used to provide a distance between the columns.\u00a0<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">android:verticalSpacing<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The \u201cverticalSpacing\u201d attribute of GridView is used to provide a distance between the rows.\u00a0<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">android:gravity<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The \u201cgravity\u201d attribute of the GridView is used to align the grid to the left, right, centre areas.\u00a0<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">android:numColumns<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The \u201cnumColumns\u201d is used to set the count of columns you need in the GridView.\u00a0<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">android:height<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The \u201cheight\u201d attribute is used to set the height of your GridView.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">android:width<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The \u201cwidth\u201d attribute is used to set the width of your GridView.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">android:stretchMode<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The \u201cstretchMode\u201d is usually used to fill the space caused by extra data elements.\u00a0<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">android:columnWidth<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The \u201ccolumnWidth\u201d is used to set the width of each of the columns of the grid.\u00a0<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Sub-Activity in Android GridView<\/h3>\n<p>Sub-Activity is like an activity that opens up when you click on an item present in the GridView. To implement this, we need to add click event listeners to each data item of the GridView. In the implementation of GridView, you will also encounter the way of implementing sub-activity with GridView.<\/p>\n<h3>Implementation of Android GridView<\/h3>\n<p>So, now we will see how you can implement GridView in your Android Applications. We will create a food listing application that will have food item pics in the form of a grid.<\/p>\n<p><strong>1:<\/strong> Run your Android Studio and click on Create a new Project.<\/p>\n<p><strong>2:<\/strong> Select Empty Activity and then provide your application name. Select Android Lollipop and then proceed.<\/p>\n<p><strong>3:<\/strong> Now, you need to design your XML layout and add a GridView there. Use the below code to get started with GridView in your layout.<\/p>\n<p><strong>Code: activity_main.xml<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"\r\n    android:orientation=\"vertical\"\r\n    android:background=\"@color\/white\"\r\n    tools:context=\".MainActivity\"&gt;\r\n\r\n    &lt;TextView\r\n        android:id=\"@+id\/title\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_marginTop=\"20dp\"\r\n        android:layout_marginBottom=\"30dp\"\r\n        android:text=\"TechVidvan GridView\"\r\n        android:gravity=\"center\"\r\n        android:textSize=\"30sp\"\r\n        android:textColor=\"#009688\"\r\n        \/&gt;\r\n    &lt;GridView\r\n        android:background=\"@color\/white\"\r\n        android:id=\"@+id\/food_grid_view\"\r\n        android:layout_width=\"match_parent\"\r\n        android:layout_height=\"match_parent\"\r\n        android:numColumns=\"2\"\r\n        android:horizontalSpacing=\"10dp\"\r\n        android:verticalSpacing=\"10dp\"\r\n        android:layout_margin=\"10dp\"\/&gt;\r\n\r\n&lt;\/LinearLayout&gt;\r\n<\/pre>\n<p><strong>4:<\/strong> Now, you need to design an XML layout to apply to each food item in the GridView.<\/p>\n<p><strong>Code: each_food_item.xml<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;com.google.android.material.card.MaterialCardView\r\n    xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    android:layout_width=\"wrap_content\"\r\n    android:layout_height=\"wrap_content\"\r\n    xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\r\n    app:cardElevation=\"15dp\"\r\n    android:layout_margin=\"10dp\"\r\n    app:cardCornerRadius=\"20dp\"\r\n    android:backgroundTint=\"@color\/white\"\r\n    android:background=\"@color\/white\"\r\n    &gt;\r\n\r\n    &lt;ImageView\r\n        android:layout_width=\"150dp\"\r\n        android:layout_height=\"150dp\"\r\n        android:layout_gravity=\"center\"\r\n        android:id=\"@+id\/food_image_view\"\/&gt;\r\n\r\n&lt;\/com.google.android.material.card.MaterialCardView&gt;\r\n<\/pre>\n<p><strong>5:<\/strong> Now, you need to create an Adapter class to add the items in GridView. For this you need to right-click on your package name and create a new Kotlin class called \u201cFoodAdapter\u201d.<\/p>\n<p><strong>Code: FoodAdapter.kt<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import android.content.Context\r\nimport android.view.LayoutInflater\r\nimport android.view.View\r\nimport android.view.ViewGroup\r\nimport android.widget.BaseAdapter\r\nimport android.widget.ImageView\r\nimport com.techvidvan.techvidvangridview.R\r\n\r\ninternal class FoodAdapter\r\n    (\r\n    \/\/getting the context and the food images list\r\n    \/\/from MainActivity\r\n    private val context: Context,\r\n    private val foodImages: IntArray\r\n) :\r\n    BaseAdapter() {\r\n\r\n    \/\/declaring variables\r\n    private var layoutInflater: LayoutInflater? = null\r\n    private lateinit var foodImageView: ImageView\r\n\r\n    override fun getCount(): Int\r\n    {\r\n        \/\/getting the count of the data items\r\n        return foodImages.size\r\n    }\r\n    override fun getItem(position: Int): Any? {\r\n        return null\r\n    }\r\n    override fun getItemId(position: Int): Long {\r\n        return 0\r\n    }\r\n    override fun getView(\r\n        position: Int,\r\n        convertView: View?,\r\n        parent: ViewGroup\r\n    ): View? {\r\n\r\n        \/\/creating the view\r\n        var foodView = convertView\r\n        if (layoutInflater == null) {\r\n\r\n            \/\/creating a layout inflater\r\n            layoutInflater =\r\n                context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater\r\n        }\r\n        if (convertView == null)\r\n        {\r\n            foodView = layoutInflater!!.inflate(R.layout.each_food_item, null)\r\n        }\r\n\r\n        \/\/fetching each image view of the card\r\n        foodImageView = foodView!!.findViewById(R.id.food_image_view)\r\n        \/\/setting the food pic in each image view\r\n        foodImageView.setImageResource(foodImages[position])\r\n\r\n        return foodView\r\n    }\r\n}\r\n<\/pre>\n<p><strong>6:<\/strong> Now, you need to create a sub-activity to show the full image of the data item you clicked. For this, you can right-click on the package name and click on new and select an empty activity. Now copy the below codes for your sub-activity.<\/p>\n<p><strong>Code: activity_sub.xml<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;androidx.constraintlayout.widget.ConstraintLayout\r\n    xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\r\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"\r\n    tools:context=\".SubActivity\"&gt;\r\n\r\n    &lt;ImageView\r\n        android:id=\"@+id\/food_full_image\"\r\n        android:layout_width=\"400dp\"\r\n        android:layout_height=\"400dp\"\r\n        app:layout_constraintBottom_toBottomOf=\"parent\"\r\n        app:layout_constraintEnd_toEndOf=\"parent\"\r\n        app:layout_constraintStart_toStartOf=\"parent\"\r\n        app:layout_constraintTop_toTopOf=\"parent\" \/&gt;\r\n\r\n&lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;\r\n<\/pre>\n<p><strong>Code: SubActivity.kt<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.techvidvan.techvidvangridview\r\n\r\nimport android.os.Bundle\r\nimport android.widget.ImageView\r\nimport androidx.appcompat.app.AppCompatActivity\r\n\r\n\r\nclass SubActivity : AppCompatActivity()\r\n{\r\n    \/\/declaring imageView variable\r\n    lateinit var foodFullImage:ImageView\r\n    override fun onCreate(savedInstanceState: Bundle?)\r\n    {\r\n        super.onCreate(savedInstanceState)\r\n        setContentView(R.layout.activity_sub)\r\n\r\n        \/\/fetching the data from the MainActivity Intent\r\n        val mIntent = intent\r\n        val food_value = mIntent.getIntExtra(\"imageInt\", 0)\r\n\r\n        \/\/binding the image view with the variable\r\n        foodFullImage = findViewById(R.id.food_full_image)\r\n\r\n        \/\/setting up the image on the image view using its resource id\r\n        foodFullImage.setImageResource(food_value)\r\n    }\r\n}\r\n<\/pre>\n<p><strong>7:<\/strong> After your layout designing and adapter creation are done, you need to add the adapter\u2019s data items. For this, you can use the below code, and your GridView will then connect to the adapter.<\/p>\n<p><strong>Code: MainActivity.kt<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.techvidvan.techvidvangridview\r\n\r\nimport FoodAdapter\r\nimport android.content.Intent\r\nimport android.os.Bundle\r\nimport android.widget.AdapterView\r\nimport android.widget.GridView\r\nimport androidx.appcompat.app.AppCompatActivity\r\n\r\n\r\nclass MainActivity : AppCompatActivity()\r\n{\r\n    \/\/declaring the GridView variable\r\n    lateinit var foodGridView: GridView\r\n    \/\/declaring a list containing images of food items\r\n    private var foodImages = intArrayOf(R.drawable.food_pics_1,\r\n        R.drawable.food_pics_2,\r\n        R.drawable.food_pics_3,\r\n        R.drawable.food_pics_4,\r\n        R.drawable.food_pics_5,\r\n        R.drawable.food_pics_6,\r\n        R.drawable.food_pics_7,\r\n        R.drawable.food_pics_8,\r\n        R.drawable.food_pics_9,\r\n        R.drawable.food_pics_10,\r\n        R.drawable.food_pics_11,\r\n        R.drawable.food_pics_12,\r\n        R.drawable.food_pics_13,\r\n        R.drawable.food_pics_14,\r\n        R.drawable.food_pics_15,\r\n        R.drawable.food_pics_16\r\n    )\r\n\r\n    override fun onCreate(savedInstanceState: Bundle?)\r\n    {\r\n        super.onCreate(savedInstanceState)\r\n        setContentView(R.layout.activity_main)\r\n\r\n        \/\/binding the gridView with our created variable\r\n        foodGridView = findViewById(R.id.food_grid_view)\r\n\r\n        \/\/creating the object of the FoodAdapter\r\n        val foodAdapter = FoodAdapter(this@MainActivity, foodImages)\r\n\r\n        \/\/setting the adapter to our GridView\r\n        foodGridView.adapter = foodAdapter\r\n\r\n        \/\/Adding On Click Event Listener to each of the food item pic\r\n        foodGridView.onItemClickListener = AdapterView.OnItemClickListener { _, _, position, _ -&gt;\r\n\r\n            \/\/creating intent object to sub activity\r\n            val myIntent = Intent(this@MainActivity, SubActivity::class.java)\r\n            \/\/passing the image resource id to the sub activity\r\n            myIntent.putExtra(\"imageInt\", foodImages[position])\r\n            \/\/starting the sub activity\r\n            startActivity(myIntent)\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p>Now, let\u2019s run the application to see how the output looks. The application displays all the food items in the form of a grid, as shown below.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/07\/App_Screenshot.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-83792\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/07\/App_Screenshot.jpg\" alt=\"Android GridView Output\" width=\"1080\" height=\"2280\" \/><\/a><\/p>\n<p>You can even scroll below to see more items. When you click on an item, then that appears in a new activity.<\/p>\n<h3>Summary<\/h3>\n<p>So through the Android GridView article, you came across a new way of listing your data items. You got to know what a GridView is and how you can use it on Android. Later you came across the various attributes present in the GridView. Finally, you came across the implementation of the Android GridView using a food item displaying app.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Think about apps like Gallery \u2013 those grids of thumbnails showcasing your photos and videos. This is a prime example of GridView in action. GridView isn&#8217;t limited to just gallery apps; it&#8217;s a versatile&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":83790,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2791],"tags":[4036,4037,4038,4039],"class_list":["post-83635","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","tag-android-gridview","tag-android-gridview-attributes","tag-implementation-of-android-gridview","tag-sub-activity-in-android-gridview"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android GridView with Implementation - TechVidvan<\/title>\n<meta name=\"description\" content=\"Android GridView is a well-known way of representing data items. Learn How to create a GridView in Android and its attributes.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/android-gridview\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android GridView with Implementation - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Android GridView is a well-known way of representing data items. Learn How to create a GridView in Android and its attributes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/android-gridview\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-16T03:30:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-05T05:42:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/07\/Android-GridView.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android GridView with Implementation - TechVidvan","description":"Android GridView is a well-known way of representing data items. Learn How to create a GridView in Android and its attributes.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/","og_locale":"en_US","og_type":"article","og_title":"Android GridView with Implementation - TechVidvan","og_description":"Android GridView is a well-known way of representing data items. Learn How to create a GridView in Android and its attributes.","og_url":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2021-08-16T03:30:14+00:00","article_modified_time":"2024-08-05T05:42:24+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/07\/Android-GridView.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Android GridView with Implementation","datePublished":"2021-08-16T03:30:14+00:00","dateModified":"2024-08-05T05:42:24+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/"},"wordCount":886,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/07\/Android-GridView.jpg","keywords":["Android GridView","Android GridView Attributes","Implementation of Android GridView","Sub-Activity in Android GridView"],"articleSection":["Android Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/android-gridview\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/","url":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/","name":"Android GridView with Implementation - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/07\/Android-GridView.jpg","datePublished":"2021-08-16T03:30:14+00:00","dateModified":"2024-08-05T05:42:24+00:00","description":"Android GridView is a well-known way of representing data items. Learn How to create a GridView in Android and its attributes.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/android-gridview\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/07\/Android-GridView.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/07\/Android-GridView.jpg","width":1200,"height":628,"caption":"Android GridView"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/android-gridview\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Android GridView with Implementation"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/83635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=83635"}],"version-history":[{"count":2,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/83635\/revisions"}],"predecessor-version":[{"id":447593,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/83635\/revisions\/447593"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/83790"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=83635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=83635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=83635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}