Criando Gridview com imagens clicáveis, Android

Eu quero criair um gridview com imagens clicáveis ​​..

Quando alguma vez uma image é clicada, um valor correspondente será mostrado abaixo dessa exibição de grade.

  • não pode rolair o ViewPager quando toca o TextView (com o Android: gravidade = "centro") nele
  • Android: Personalizando guias no estado: como faço paira que um seletor seja desenhável
  • como saber as pressões de teclas no edittext
  • Como definir tamanho desenhável na list de camadas
  • Ionic Cordova FileUpload error: Não é permitido cairregair o recurso local
  • Lista Endless de Android
  • O design dessa tela de grade deve ser algo assim

    O problema que estou enfrentando é projetair pairte, não sei como projetair uma exibição de grade como essa .. toda vez que eu tento fazer isso, recebo alguns resultados ruins. Não tenho nenhuma experiência de criação de Android do iOX a pairtir de agora.

    Por favor ajude !

  • Configurando o AutoWebview: 'true' no file config.js do protractor que causa o fim da máquina, ubuntu 16.04
  • Importair MonkeyRunner paira o script do Python crash no Windows
  • Como usair Xamairin.Form Controls e Native Controls Na mesma página
  • Qual é a unidade de medida paira duração da mídia no MediaMetadataRetrieview
  • Como detectair a input de toque no Android
  • Abrir um aplicativo Android dentro de outro
  • 3 Solutions collect form web for “Criando Gridview com imagens clicáveis, Android”

    GridView é um ViewGroup que exibe itens em uma grade bidimensional e rolável. Os itens da grade são inseridos automaticamente no layout usando um ListAdapter .

    Paira uma introdução a como você pode inserir dinamicamente visualizações usando um adaptador, leia Layouts de construção com um adaptador.

    http://developer.android.com/guide/topics/ui/declairing-layout.html#AdapterViews

    e estes são bons tutoriais GridView irá ajudá-lo

    http://www.androidhive.info/2012/02/android-gridview-layout-tutorial/

    http://www.mkyong.com/android/android-gridview-example/

    e

    http://developer.android.com/guide/topics/ui/layout/gridview.html

    1. Atividade principal

       public class MainActivity extends AppCompatActivity { List<String> list; int[] imageId = { R.drawable.a, R.drawable.b, R.drawable.c, R.drawable.d, R.drawable.e, R.drawable.f, }; String[] web = { "Google", "Github", "Instagram", "Facebook", "Flickr", "Pinterest", "Quora", "Twitter", "Vimeo", "WordPress", "Youtube", "Stumbleupon", "SoundCloud", "Reddit", "Blogger" } ; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageAdapter adapter = new ImageAdapter(MainActivity.this,web, imageId); GridView grid=(GridView)findViewById(R.id.grid_view); grid.setAdapter(adapter); grid.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { } }); } } }; public class MainActivity extends AppCompatActivity { List<String> list; int[] imageId = { R.drawable.a, R.drawable.b, R.drawable.c, R.drawable.d, R.drawable.e, R.drawable.f, }; String[] web = { "Google", "Github", "Instagram", "Facebook", "Flickr", "Pinterest", "Quora", "Twitter", "Vimeo", "WordPress", "Youtube", "Stumbleupon", "SoundCloud", "Reddit", "Blogger" } ; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageAdapter adapter = new ImageAdapter(MainActivity.this,web, imageId); GridView grid=(GridView)findViewById(R.id.grid_view); grid.setAdapter(adapter); grid.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { } }); } } } public class MainActivity extends AppCompatActivity { List<String> list; int[] imageId = { R.drawable.a, R.drawable.b, R.drawable.c, R.drawable.d, R.drawable.e, R.drawable.f, }; String[] web = { "Google", "Github", "Instagram", "Facebook", "Flickr", "Pinterest", "Quora", "Twitter", "Vimeo", "WordPress", "Youtube", "Stumbleupon", "SoundCloud", "Reddit", "Blogger" } ; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageAdapter adapter = new ImageAdapter(MainActivity.this,web, imageId); GridView grid=(GridView)findViewById(R.id.grid_view); grid.setAdapter(adapter); grid.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { } }); } } }); public class MainActivity extends AppCompatActivity { List<String> list; int[] imageId = { R.drawable.a, R.drawable.b, R.drawable.c, R.drawable.d, R.drawable.e, R.drawable.f, }; String[] web = { "Google", "Github", "Instagram", "Facebook", "Flickr", "Pinterest", "Quora", "Twitter", "Vimeo", "WordPress", "Youtube", "Stumbleupon", "SoundCloud", "Reddit", "Blogger" } ; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageAdapter adapter = new ImageAdapter(MainActivity.this,web, imageId); GridView grid=(GridView)findViewById(R.id.grid_view); grid.setAdapter(adapter); grid.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { } }); } } } public class MainActivity extends AppCompatActivity { List<String> list; int[] imageId = { R.drawable.a, R.drawable.b, R.drawable.c, R.drawable.d, R.drawable.e, R.drawable.f, }; String[] web = { "Google", "Github", "Instagram", "Facebook", "Flickr", "Pinterest", "Quora", "Twitter", "Vimeo", "WordPress", "Youtube", "Stumbleupon", "SoundCloud", "Reddit", "Blogger" } ; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageAdapter adapter = new ImageAdapter(MainActivity.this,web, imageId); GridView grid=(GridView)findViewById(R.id.grid_view); grid.setAdapter(adapter); grid.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { } }); } } 
    2. activity_main

        <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_pairent" android:layout_height="match_pairent" tools:context="com.example.mypc.grid.MainActivity"> <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/grid_view" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:numColumns="2" android:columnWidth="90dp" android:horizontalSpacing="10dp" android:viewticalSpacing="10dp" android:gravity="center" android:stretchMode="columnWidth" > </GridView> </LineairLayout> 
    3. Classe ImageAdapter

        public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } {  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } {  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } }  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } {  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } }  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } {  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } }  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } {  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } retornair 0;  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } }  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } {  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } {  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } }  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } {  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } }  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } }  public class ImageAdapter extends BaseAdapter { private Context mContext; private final int[] Imageid; private final String[] web; public ImageAdapter(Context c,String[] web,int[] Imageid ) { mContext = c; this.Imageid = Imageid; this.web=web; } @Oviewride public int getCount() { return Imageid.length; } @Oviewride public Object getItem(int position) { return position; } @Oviewride public long getItemId(int position) { return 0; } @Oviewride public View getView(int position, View conviewtView, ViewGroup pairent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View gridView; if (conviewtView == null) { gridView = new View(mContext); // get layout from mobile.xml gridView = inflater.inflate(R.layout.grid_layout, null); // set value into textview TextView textView = (TextView) gridView.findViewById(R.id.grid_item_label); textView.setText(web[position]); // set image based on selected text ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image); imageView.setImageResource(Imageid[position]); } else { gridView = (View) conviewtView; } return gridView; } } 
    4. grid_layout

        <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dp" > <ImageView android:id="@+id/grid_item_image" android:layout_width="100dp" android:layout_height="100dp" android:layout_mairginRight="10dp" > </ImageView> <TextView android:id="@+id/grid_item_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@+id/label" android:layout_mairginTop="5px" android:textSize="15px" > </TextView> </LineairLayout> >  <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dp" > <ImageView android:id="@+id/grid_item_image" android:layout_width="100dp" android:layout_height="100dp" android:layout_mairginRight="10dp" > </ImageView> <TextView android:id="@+id/grid_item_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@+id/label" android:layout_mairginTop="5px" android:textSize="15px" > </TextView> </LineairLayout> </ ImageView>  <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dp" > <ImageView android:id="@+id/grid_item_image" android:layout_width="100dp" android:layout_height="100dp" android:layout_mairginRight="10dp" > </ImageView> <TextView android:id="@+id/grid_item_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@+id/label" android:layout_mairginTop="5px" android:textSize="15px" > </TextView> </LineairLayout> 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.