Back to project page ScanGoods.
The source code is released under:
Apache License
If you think the Android project ScanGoods listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.munix.gridviewheader; //from ww w . j a v a 2s . co m import android.os.Bundle; import android.app.Activity; import android.view.View; import android.widget.Toast; public class MainActivity extends Activity { private HeadGridView list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); list = (HeadGridView)this.findViewById(R.id.list); list.setNumColumns(2); String strings[] = new String[100]; for (int i = 0; i < strings.length; i++) strings[i] = new String("Pos " + i); View header = View.inflate( this, R.layout.item, null); list.addHeaderView(header); list.setNumColumns(2); TestAdapter adapter = new TestAdapter(this, strings); list.setAdapter(adapter); //Puedes dejar la cabecera fija //list.setFixedHeader(true); } public void fun( View v ) { Toast.makeText(v.getContext(), "Click", Toast.LENGTH_SHORT).show(); list.removeHeaderView(); } }