Reputation: 303
I am trying to implement grid layout in android as shown in the image attached below but,not succeeded. The problem is the column width is not fitting in the grid the column string is aligning vertically letter by letter as number of columns increasing. Here it would be better if data source is a string array some thing like this
String[] Data={"Long Short","Symbol","Volume",
"Undl Price","Type","Strike Price",
"Option Price","Volatility"
"Long","NIFTY","25","8692.80","CALL",
"8800.00","78.95","14.9737",
"Long","NIFTY","25","8692.80",
"CALL","9000.00","25.05","15.0352",
}
please suggest a way to get grid view as shown in image or in alternative way. I appreciate any suggestion I get on this .
Thanks in advance!!
Upvotes: 0
Views: 57
Reputation: 5121
<GridView
android:id="@+id/customGridView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/titleLayout"
android:layout_alignParentLeft="true"
android:numColumns="8" > // put the number of column that you want to show
</GridView>
here titleLayout is the layout in which you have to make one layout which is contains the title ( that is your Data String Array ), this array you can inflate it custom also or you can put it as static also
Upvotes: 1