There is no ListView in this layout. Hence, this is not the correct layout.
Here is a sample project showing a ListView with a TextView above it: http://github.com/commonsguy/cw-android/tree/master/Selection/List/ On Fri, Sep 3, 2010 at 8:56 AM, A N K ! T <[email protected]> wrote: > but how ....where to write it.... > layout code is>>>>>>> > > <LinearLayout > xmlns:android="http://schemas.android.com/apk/res/android" > android:layout_height="wrap_content" android:layout_width="fill_parent"> > <ImageView > android:id="@+id/icon" > android:layout_width="40sp" > android:layout_height="wrap_content" > android:src="@drawable/on" android:visibility="visible"/> > <TextView > android:id="@+id/label" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:textSize="20sp"/> > > </LinearLayout> > > > On Fri, Sep 3, 2010 at 6:00 PM, Mark Murphy <[email protected]> wrote: >> >> If you want it to scroll with the list, use addHeaderView(). If you do >> not want it to scroll with the list, put it above the ListView using a >> LinearLayout or RelativeLayout. >> >> On Fri, Sep 3, 2010 at 8:28 AM, A N K ! T <[email protected]> >> wrote: >> > am making a list by this code>>>>> >> > >> > public class myList extends ListActivity{ >> > >> > private static EfficientAdapter efficientAdapter; >> > private static class EfficientAdapter extends BaseAdapter { >> > static Bitmap bmp[] = new Bitmap[3]; >> > private LayoutInflater mInflater; >> > >> > >> > >> > public EfficientAdapter(Context context) { >> > mInflater = LayoutInflater.from(context); >> > >> > bmp[1] = >> > BitmapFactory.decodeResource(context.getResources(), >> > R.drawable.icon1); >> > bmp[2] = >> > BitmapFactory.decodeResource(context.getResources(), >> > R.drawable.icon2); >> > bmp[3] = >> > BitmapFactory.decodeResource(context.getResources(),R.drawable.icon3); >> > >> > } >> > >> > >> > public int getCount() { >> > return DATA.length; >> > } >> > >> > >> > public Object getItem(int position) { >> > >> > return position; >> > } >> > >> > >> > public long getItemId(int position) { >> > return position; >> > } >> > >> > iew(int position, View convertView, ViewGroup parent) { >> > >> > ViewHolder holder; >> > if (convertView == null) { >> > >> > convertView = mInflater.inflate(R.layout.mainscreen, >> > null); >> > >> > holder = new ViewHolder(); >> > holder.text = (TextView) >> > convertView.findViewById(R.id.label); >> > holder.icon = (ImageView) >> > convertView.findViewById(R.id.icon); >> > holder.text.setGravity(Gravity.CENTER_VERTICAL); >> > holder.text.setHeight(64); >> > holder.icon.setMinimumHeight(64); >> > convertView.setTag(holder); >> > >> > } else { >> > holder = (ViewHolder) convertView.getTag(); >> > } >> > >> > holder.text.setText(DATA[position]); >> > holder.icon.setImageBitmap((bmp[position])); >> > >> > return convertView; >> > } >> > >> > static class ViewHolder { >> > TextView text; >> > ImageView icon; >> > >> > } >> > } >> > >> > >> > >> > @Override >> > protected void onCreate(Bundle savedInstanceState) { >> > super.onCreate(savedInstanceState); >> > efficientAdapter = new EfficientAdapter(this); >> > >> > setListAdapter(efficientAdapter); >> > >> > >> > and want to add a text view on the top of list...but it should not be >> > the >> > list item >> > >> > -- >> > >> > A N K ! T...... >> > >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "Android Developers" group. >> > To post to this group, send email to [email protected] >> > To unsubscribe from this group, send email to >> > [email protected] >> > For more options, visit this group at >> > http://groups.google.com/group/android-developers?hl=en >> >> >> >> -- >> Mark Murphy (a Commons Guy) >> http://commonsware.com | http://github.com/commonsguy >> http://commonsware.com/blog | http://twitter.com/commonsguy >> >> _The Busy Coder's Guide to Android Development_ Version 3.1 Available! >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > -- > > A N K ! T...... > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.1 Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

