Hi,

I am trying to create a simple adapter for Gallery.  And I call
setAdapter() of my Gallery.
The text is displayed on screen, but they are overlapping each other.
Do I need to set the size of the TextView that I create to make sure
it has enough space for the text it is holding? if yes, how to do
that?

public class MyAdapter extends BaseAdapter {

        private String[] values = {"name1", "name2", "name3", "name4"};
        
        public View getView(int position, View convertView, ViewGroup parent) {

                TextView tv = new TextView(mContext);
                tv.setText(values[position]);
                
                return tv;
        }

        public int getCount() {
                return values.length;
        }

        public Object getItem(int position) {
                return  position;
        }

        public long getItemId(int position) {
                return position;
        }

        public void setContext(Context mContext) {
                this.mContext = mContext;
        }

        

}

Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to