0

can you help me make simple Gridview with 2 Textviews, Item is Textview 1, and SubItem is TextView 2..like this:

ITEM 1            ITEM 2

subitem1          subitem2

I have examples with ImageViews but how to accomplish this with two textviews, is there example? Should I use custom adapter or there is simpler way?

vitas_kek
  • 41
  • 7

4 Answers4

1

You can place any content in the Grid item. Just you need to change the list item layout according to your requirements.You can find the example here

Community
  • 1
  • 1
Prasad
  • 3,462
  • 1
  • 23
  • 28
0

Simply change the ImageView with TextView in your GridView item layout.

Jas
  • 3,207
  • 2
  • 15
  • 45
0

You can try like this: How to create customized grid view with two textview

Instead of this line: String header = first_String_Variable+"\n"+second_String_Variable;

use this: String header=first_String_Variable+" "+second_String_Variable;

and set grid by using Adapter..

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, header);
gridHeader.setAdapter(adapter);

Finally you have only one textview that looks like two textviews.

Community
  • 1
  • 1
0

Just use two TextView in the item of GridView in the custom adapter.

Wasim Reza
  • 136
  • 6