Langsung ke konten utama

Postingan

Menampilkan postingan dengan label dynamic grid

How to Add and Remove Grids in GridView Dynamically

In this post, I will show you how to add and remove grids in GridView. And also, I am explained about SharedPreferences. Project Structure: Create a new Project in Eclipse/Android Studio with the required Specifications. Codes: activity_main.xml Create activity_main.xml and replace it with the following code <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightSum="5" android:orientation="vertical"> <GridView android:id="@+id/gridView1" android:layout_width="match_parent" android:layout_height="0dp" android:columnWidth="100dp" android:gravity="center" android:numColumns="auto_fit" android:stretchMode="columnWidth" android:layout_weight="4.5"/> <LinearLayo...