Hi, I'm trying out the SDK and am attempting to combine a ScrollView with table layout and GridView. For each row of the table I want a list of TextView's stored in GridView. With my current layout, all of the text views in the grid end up overlaying each other. Can anyone tell me how to give each TextView in the grid a set width so that I can see each text value? I've tried both the ScrollView and HorizontalScrollView widgets and both produce the same results.
I've developed a basic Adapter for the GridView which may be the problem. I can't find any good examples or other doc's that explan the us of the Adater class for gridview any better. I'm using the following layout: <?xml version="1.0" encoding="utf-8"?> <HorizontalScrollView android:id="@+id/ScrollView01" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <TableLayout android:id="@+id/TableLayout01" android:layout_height="wrap_content" android:layout_width="fill_parent"> <TableRow android:id="@+id/TableRow01" android:layout_height="wrap_content" android:layout_width="fill_parent"> <TextView android:id="@+id/TextView01" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="Inning"> </TextView> <GridView android:id="@+id/GridView01" android:layout_height="wrap_content" android:layout_width="fill_parent" android:numColumns="10" android:minWidth="25px"> </GridView> </TableRow> </TableLayout> </HorizntalScrollView> I've set up a very basic grid adapter here's the code: package com.example.hsview; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.GridView; import android.widget.TextView; public class GridAdapter extends BaseAdapter { private Context context; private String[] texts = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "Out"}; public GridAdapter(Context context) { this.context = context; } public int getCount() { return texts.length; } public Object getItem(int position) { return texts[position]; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { TextView tv; if (convertView == null) { tv = new TextView(context); tv.setLayoutParams(new GridView.LayoutParams(30, 30)); } else { tv = (TextView) convertView; } tv.setText(texts[position]); tv.setWidth(30); return tv; } } And finally, here's the app startup code: package com.example.hsview; import android.app.Activity; import android.os.Bundle; import android.widget.GridView; public class ExampleHSView extends Activity { GridView inningView, homescoreView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); inningView = (GridView)this.findViewById(R.id.GridView01); inningView.setAdapter(new GridAdapter(this)); } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---