2

Am developing a calculator in Android. I placed all the numbers and arithmetic operators in a grid view. The following is the xml code of the grid view :

<GridView
    android:id="@+id/gridView1"
    android:layout_width="320dp"
    android:layout_height="270dp"
    android:layout_below="@+id/textView2"
    android:layout_centerHorizontal="true"
    android:columnWidth="20dp"
    android:horizontalSpacing="50dp"
    android:numColumns="4"
    android:padding="0dp"
    android:verticalSpacing="20dp" >
</GridView>

I need to give colours to each cell of the grid view. Is it possible to do that ? If yes, how ?

Tomin Jacob
  • 333
  • 1
  • 9
  • 24
  • Check this [Change Color of cell of grid](http://stackoverflow.com/questions/12315714/change-color-of-cell-of-grid) – SaravanaRaja Aug 15 '14 at 16:34

2 Answers2

1

u need to set an adapter .. check below link

http://developer.android.com/guide/topics/ui/layout/gridview.html
DRY Believer
  • 1,001
  • 11
  • 20
0

Simply searching in stackOverflow got a link How set Alternate Cell Color in a Grid. An accepted ans. was present , but the code works for to set Alternate Cell Color More possibilities are ter to solve your problem.

Community
  • 1
  • 1
SaravanaRaja
  • 3,228
  • 2
  • 21
  • 29